[SDL] "The procedure entry point SDL_UpperBlit could not be
Rhythmic Fistman
rfistman at gmail.com
Sun Apr 1 03:49:26 PDT 2007
> From: "Chris Stones" <chris.stones at gmail.com>
> Greetings.... ( first post)
>
> At work, i am developing a small cross platform game engine, that uses a
> plugin architechture for rending / sound
[...]
> In Linux, This is all working beautifully, the dynamic linker resolving all
> symbols blah blah blah.. BRILLIANT...
>
> However, in Windows, on calling LoadLibrary(< SDL_Graphics_Plugin>) ( where
> the plugin is linked to SDL.lib and SDLmain.lib )
> i get the following error message
It is possible to build and load the plugin, you have a bad linker setting
somewhere, and I don't know which nor why the problem should only
show up with SDL_UpperBlit. However, I DO know that when you fix the plugin
build, you'll run into another problem: non-linux versions (at least win32
and macos) of SDL define their own main functions (!) renaming your one
(which *must* have the slightly strange-to-my-eyes form
int main(int argc, char* argv[])) with a macro. I guess the idea was
originally to hide the existence of annoyances like WinMain, and then to
get a first shot at main's arguments (instance handles), but somewhere along
the way a heap non-trivial platform-specific initialisation code snuck in and
the upshot is that in your plugin, even if you call SDL_Init, SDL won't
be completely initialised and you'll probably crash. Main tom-foolery
unfortunately
inverts the relationship between application and library, effectively
making your
application a library of SDLmain, it also makes SDL incompatible with other
main tom-foolery libraries. So, no plugin for you.
Work arounds:
1) give up on plugin idea, include SDL.h in your main file (remembering to
declare your main as above)
2) look in SDL-1.2/src/main/win32 and do a bit of cut'n'pasting into the part
of your win32 SDL plugin that calls SDL_Init. Cutting and pasting's a real
pain when the code is there, but uncallable because it lives in a file with
function that you've already defined ("main" or "WinMain"). It's a
given that SDL
must have platform specific initialisation, but I wish the the code were
explicitly callable. Exporting symbols like
int SDL_WinInit(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw)
int SDL_osx_init(int, char**)
would save plugin writers and people who bind SDL to non-c languages
a lot of hassle.
I don't know if anything has been done for SDLmain prob for SDL 1.3. I doubt
it since most people don't regard this as a real problem and I'm likely
just adding to my reputation as an SDLmain crank. Chris, you're
probably perfectly
happy to dump your plugin architecture and just wanted to know which magic flag
to set in VS. Sorry!
RF
--
felix: lightweight threads, HOFs and game scripting.
svn co https://svn.sourceforge.net/svnroot/felix/felix/trunk felix
More information about the SDL
mailing list