Question

I have tried to find how to create DLL-s on linux using google, but got very confusing information.

Is it possible to write dynamic link libraries on linux? If not, are there other means by which I can call code in another module from several running programs?

Was it helpful?

Solution

That's because DLL is a Windows term. In Linux they are called shared libraries.

http://www.linux.org/docs/ldp/howto/Program-Library-HOWTO/shared-libraries.html

OTHER TIPS

As Sklivvz has said, the term you're after on linux is shared object. These are given the file extension .so.

Using gcc you can create a .so by using the -shared option.

eg.


gcc -shared -o libfoo.so foo.c

If you name your shared object lib*.so you can compile against it by using the -l option on your linker. Note that the "lib" is inferred in this circumstance.

ie.


ld -o a.out -lfoo someobject.o 

Alternatively you can load .so files at runtime, just as you can with .dlls, using dlopen() and dlsym().

It is a lot if you are just getting started, but at some point you will need to refer to Ulrich Drepper’s “How To Write Shared Libaries.”

I guess .SO files instead of DLL files, meaning shared object, not StackOverflow :), is what you want.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top