In reference to my first post: Mozilla use a C DLL with js-ctypes
I\'m trying to build a DLL to be used from a Mozilla Firefox extension. I created a little C code a
If you compile the library like that you get a dependency on msvcrt.dll which probably cannot be resolved on your system (redistributable package required), on mine it works fine. You can compile your library without the dependency on the CRT, you just have to define DllMain yourself:
#include<windows.h>
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
return TRUE;
}
int add(int a,int b)
{
return(a+b);
}
And the link step looks like this:
gcc -shared -nostdlib -o library.dll library.o -Wl,-e_DllMain@12
You cannot use CRT functionality then - I couldn't find a way to compile the runtime statically with GCC on Windows (Visual C++ on the other hand does it just fine).