Dynamically link SDL lib

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 ?

Check this
ls /usr/lib/libSDL*

OUuups… thankS, i found it !

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

Originally posted by MPech:
[b]OUuups… thankS, i found it !

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

[/b]

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

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 ?

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… :frowning:

Anyone helps ?

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

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.