Hi,
while trying to use SDL for the Shark 3D engine on Windows with MS VC++ 5
I ran into a problem that I have not been able to solve:
When I try to load SDL-dx5.dll (generated by the cross-compiler) within another
DLL (our SDL driver), LoadLibrary crashes.
It works perfectly when I load SDL-dx5.dll directly from the main program.
Can anybody help me or reproduce the crash? I appended a short test program.
Thanks
- Markus------------------------------------------------------------------------------
/* Compile this as Win32 Dynamic Link Library */
#include <windows.h>
void _declspec(dllexport) test_load()
{
void* libhandle = (void *)LoadLibrary( “SDL-dx5.dll” );
}
/* Compile this as Win32 Application and link it with the DLL above */
#include <windows.h>
void test_load();
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw)
{
test_load();
return 0;
}
When I try to load SDL-dx5.dll (generated by the cross-compiler) within another
DLL (our SDL driver), LoadLibrary crashes.
Have you tried building the SDL DLL with MS VC++?
Not really. I made an attempt some while ago, but probably did not define
all necessary preprocessor definitions. Has anybody else tried it?
BTW, I found some mails in the cygwin archives about similar problems,
it could be a problem of mingw32.
- MarkusOn Thu, 17 Dec 1998, Sam Lantinga wrote:
Hello,
maybe I should give you an update: I compiled SDL-dx5 and SDL-dib with
MSVC 5. Loading the library within another DLL now works without problems.
Here are some notes on compiling SDL with MSVC:
-
I had to define _BUIDING_SDL,WIN32
-
The function “alloca” has the name “_alloca” in MSVC. I defined
a macro in the project settings.
-
Tons of warnings. Every time begin_code is included I get a warning
about the changing of struct alignment. I added a MSVC-specific
pragma: #pragma warning(disable:4103) for avoiding this. The other
warnings are mainly about integral size mismatches (mostly int ->
short in SDL_blit_AK.c).
-
There is still some code in directx/SDL_sysvideo.c in PrintSurface that
depends on NONAMELESSUNION.
I could compile the libraries. Unfortunately it still does not work as I
would like it to. When I use SDL within my DLL (which uses SDL to get
input events at present) it runs, but SDL_Quit crashes so heavily, that I
have to reboot Windows… It happens both with SDL-dx5 and SDL-dib.
It again seems to happen because of the DLL again, because the demo
"water" runs well with SDL-dib.
BTW, I had some contact with Paulus some weeks ago, because I noted that
his sdllib.lib must use the same runtime C library as the application,
otherwise it crashes. He used the mingw32 SDL-DLLs at that time.
Somehow using SDL under windows seems to be much more painful than under
Linux
But I would really like to use the same driver for both.
See you