lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


All the time I wondered about the dependencies and size of bit.dll.

Encouraged by my work on a gpx decompression lib I twiddled 
around with LuaBitOp-1.0.1 and did the following patch



bit.c
180,192d177
+ #ifdef _WIN32
+ #pragma comment(linker, "/OPT:NOWIN98")
+ 
+ #include <windows.h>
+ BOOL WINAPI DllMain(
+    HINSTANCE hinstDLL,
+    DWORD fdwReason,
+    LPVOID lpvReserved
+ )
+ {
+ 	return TRUE;
+ }
+ #endif


msvcbuild.bat
21c20
- %MYLINK% /DLL /export:luaopen_bit /out:bit.dll bit.obj %LUA_LIB%
+ %MYLINK% /DLL /entry:"DllMain" /export:luaopen_bit /out:bit.dll 
  bit.obj %LUA_LIB%

And WOW, this reduced bit.dll from 20480 to 4096 bytes and completly 
removed the dependency from any msvcrt*.dll. I did not see any bad 
side effects yet, the msvctest.bat runs flawlessly. 

Do you have any cons for this approach?

Regards Jørgen