File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -365,6 +365,12 @@ fn addLua(
365365 lua_exe .addIncludePath ("inc" ++ std .fs .path .sep_str ++ "libc" );
366366 lua_exe .linkLibrary (libc_only_std_static );
367367 lua_exe .linkLibrary (zig_start );
368+ // TODO: should libc_only_std_static and zig_start be able to add library dependencies?
369+ if (target .getOs ().tag == .windows ) {
370+ lua_exe .addIncludePath ("inc/win32" );
371+ lua_exe .linkSystemLibrary ("ntdll" );
372+ lua_exe .linkSystemLibrary ("kernel32" );
373+ }
368374
369375 const step = b .step ("lua" , "build the LUA interpreter" );
370376 step .dependOn (& lua_exe .install_step .? .step );
Original file line number Diff line number Diff line change @@ -100,5 +100,8 @@ void perror(const char *s);
100100 #define FOPEN_MAX 999
101101#endif
102102
103+ #ifdef _WIN32
104+ FILE * _popen (const char * command , const char * mode );
105+ #endif
103106
104107#endif /* _STDIO_H */
Original file line number Diff line number Diff line change 1+ #ifndef _BASETSD_H
2+ #define _BASETSD_H
3+
4+ #include "private/types.h"
5+
6+ #endif /* _BASETSD_H */
Original file line number Diff line number Diff line change 1+ #ifndef _ERRHANDLINGAPI_H
2+ #define _ERRHANDLINGAPI_H
3+
4+ #include "private/types.h"
5+ DWORD GetLastError ();
6+
7+ #endif /* _ERRHANDLINGAPI_H */
Original file line number Diff line number Diff line change 1+ #ifndef _IO_H
2+ #define _IO_H
3+
4+ // NOTE: I'm not sure if Windows even provides this header but
5+ // lua wants it if compiling for windows I guess?
6+
7+ #endif /* _IO_H */
Original file line number Diff line number Diff line change 1+ #ifndef _LIBLOADERAPI_H
2+ #define _LIBLOADERAPI_H
3+
4+ HMODULE LoadLibraryExA (LPCSTR lpLibFileName , HANDLE hFile , DWORD dwFlags );
5+ BOOL FreeLibrary (HMODULE hLibModule );
6+ DWORD GetModuleFileNameA (HMODULE hModule , LPSTR lpFilename , DWORD nSize );
7+
8+ #endif /* _LIBLOADERAPI_H */
Original file line number Diff line number Diff line change 1+ #ifndef _WIN32_PRIVATE_TYPES_H
2+ #define _WIN32_PRIVATE_TYPES_H
3+
4+ #include "../../libc/private/int32_t.h"
5+
6+ #define _nullterminated
7+
8+ typedef int BOOL ;
9+ typedef void * PVOID ;
10+ typedef const void * LPCVOID ;
11+ typedef int32_t DWORD ;
12+ typedef char CHAR ;
13+ typedef CHAR * LPSTR ;
14+ typedef _nullterminated const char * LPCSTR ;
15+ typedef void * HMODULE ;
16+ typedef PVOID HANDLE ;
17+
18+ #ifdef UNICODE
19+ typedef LPWSTR LPTSTR ;
20+ #else
21+ typedef LPSTR LPTSTR ;
22+ #endif
23+
24+ #endif /* _WIN32_PRIVATE_TYPES_H */
Original file line number Diff line number Diff line change 1+ #ifndef _WINBASE_H
2+ #define _WINBASE_H
3+
4+ DWORD FormatMessageA (
5+ DWORD dwFlags ,
6+ LPCVOID lpSource ,
7+ DWORD dwMessageId ,
8+ DWORD dwLanguageId ,
9+ LPTSTR lpBuffer ,
10+ DWORD nSize ,
11+ va_list * Arguments );
12+
13+ #define FORMAT_MESSAGE_ALLOCATE_BUFFER 0x00000100
14+ #define FORMAT_MESSAGE_ARGUMENT_ARRAY 0x00002000
15+ #define FORMAT_MESSAGE_FROM_HMODULE 0x00000800
16+ #define FORMAT_MESSAGE_FROM_STRING 0x00000400
17+ #define FORMAT_MESSAGE_FROM_SYSTEM 0x00001000
18+ #define FORMAT_MESSAGE_IGNORE_INSERTS 0x00000200
19+ #define FORMAT_MESSAGE_FROM_SYSTEM 0x00001000
20+
21+ #endif /* _WINBASE_H */
Original file line number Diff line number Diff line change 1+ #ifndef _WINDEF_H
2+ #define _WINDEF_H
3+
4+ #include "private/types.h"
5+
6+ #endif /* _WINDEF_H */
Original file line number Diff line number Diff line change 1+ #ifndef _WINDOWS_H
2+ #define _WINDOWS_H
3+
4+ #include "private/types.h"
5+
6+ #include "winbase.h"
7+ #include "errhandlingapi.h"
8+ #include "libloaderapi.h"
9+
10+ #define MAX_PATH 260
11+
12+ #endif /* _WINDOWS_H */
You can’t perform that action at this time.
0 commit comments