Shared objects, a quick and not too dirty example to open a library?

3 posts / 0 new
Last post
AmigaBlitter
AmigaBlitter's picture
Offline
Last seen: 6 years 1 month ago
Joined: 2012-02-18 19:55
Shared objects, a quick and not too dirty example to open a library?

Hello everyone,

never used the shared object under AOS.
Could someone show me a quick example on how to open a shared object library under AOS 4?
In particular i would like to open the SDL via shared object for tests.

Thank you very much.

broadblues
broadblues's picture
Offline
Last seen: 4 years 1 month ago
Joined: 2012-05-02 21:48
Re: Shared objects, a quick and not too dirty example to open...

You don't "open" a shared object based library, you link against it.
No user code is required.

The difference is at the linking stage.

you add -use-dynld to the link line

gcc -o myproject object1.o object2.o -use-dynld -lSDL etc etc

If you want to create shared object based plugins / modules that's a bit different, you can load them at runtime using libdl, but that doesn't sound like what you are asking. If it really is what you want, say, and I'll dig an example out.

AmigaBlitter
AmigaBlitter's picture
Offline
Last seen: 6 years 1 month ago
Joined: 2012-02-18 19:55
Re: Shared objects, a quick and not too dirty example to open...

Thank you broadblues.

Any performance differences using .so or .static?

Log in or register to post comments