PDA

View Full Version : dynamically link SDL lib



MPech
03-29-2002, 01:14 AM
Hello there !

I would like to link dynamically SDL so that i won't have to reveal my source code.

I have de-RPM the devel lib and the runtime libs to my computer but I can't find any "libSDL.so" or equivalent.

Someone can help me ?

03-29-2002, 01:20 AM
Check this
ls /usr/lib/libSDL*

MPech
03-29-2002, 01:24 AM
OUuups... thankS, i found it !

i just tried : locate libSDL...
and it returned me nothing !

satan
03-29-2002, 01:33 AM
Originally posted by MPech:
OUuups... thankS, i found it !

i just tried : locate libSDL...
and it returned me nothing !



perhaps you should have updated your database before using locate
run updatedb as root to do this

MPech
03-29-2002, 01:52 AM
yes it works.

All i have to do to dynamically link it is to
make reference to the SDL include rep ("with -I./SDLinclude for example") and to the dynamic lib SDl rep ("with -lSDL")

Am I wrigth, or did i forgot anything ?

MPech
03-29-2002, 07:50 AM
I'm building a shared object library (equivalent of DLL under Win32) which is itself dinamicly linked to libSDL.so.
I use the SDL_ListModes() function in my library.

test.cpp <- myLibrary.so <- libSDL.so

When i build/compile myLibrary.so, everything looks find, no warning at all.

but when i try to use it in an other program it tells me :

-> myLibrary.so : undefined reference to SDL_ListModes()

it may be a link error or something like that but i can't say how to fix it... :-(

Anyone helps ?

03-31-2002, 08:32 PM
You have to link your programs that is using your new library to SDL also. This is normal, compare how you have to link to the X libraries if you are using the standard GLUT library. You can build your library so that it will take care of the SDL libraries, like the GLUT in Mesa take cares of the X libraries.

Here is some information http://rute.sourceforge.net/node26.html