OT: Linux .so linking

G

Gernot Frisch

Hi,

when I make test.so and link it to opengl functions -lGL, then I need
libGL.so when linking to test.so afterwards as well... Why do I need
to link against libGL.so in the first place, if I have to provide the
dependencies later?

--
-Gernot
int main(int argc, char** argv) {printf
("%silto%c%cf%cgl%ssic%ccom%c", "ma", 58, 'g', 64, "ba", 46, 10);}

________________________________________
Looking for a good game? Do it yourself!
GLBasic - you can do
www.GLBasic.com
 
V

Vyacheslav Kononenko

Gernot said:
Hi,

when I make test.so and link it to opengl functions -lGL, then I need
libGL.so when linking to test.so afterwards as well... Why do I need
to link against libGL.so in the first place, if I have to provide the
dependencies later?
You do not have to specify -lGl when you build your own shared library.
Did you pass -shared to gcc when you create your lib? If you just
specify name with .so extension with -o that does not make it shared
library.
 
G

Gernot Frisch

Vyacheslav Kononenko said:
You do not have to specify -lGl when you build your own shared
library.
Did you pass -shared to gcc when you create your lib? If you just
specify name with .so extension with -o that does not make it shared
library.

I did. Now my .so file is working good (--shared -static) , but if I
need to link against it, I will have to provide libGL.so.x files as
well, even if I thought all dependencies are already inside my .so, so
when linking my executable it wouldn't matter...

-Gernot
 
V

Vyacheslav Kononenko

Gernot said:
I did. Now my .so file is working good (--shared -static) , but if I
need to link against it, I will have to provide libGL.so.x files as
well, even if I thought all dependencies are already inside my .so, so
when linking my executable it wouldn't matter...

-Gernot
I don't think that -static makes any differences when you make a shared
library. Just because calls from your library are NOT resolved when you
library is built. If I understand you correctly you are trying to link
libGl.so into your library so program will use only your lib and will
not require libGl.so to exist. I do not see the way to achieve this
goal. What you can do is make your.so depend on libGl.so so you will not
have to specify libGl explicitly when you link your program. But you
will have to provide libGl.so at runtime anyway.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,814
Latest member
SpicetreeDigital

Latest Threads

Top