On Wednesday 05 April 2006 5:40 am, vince@complex.elte.hu wrote:
There is a program which might run under Linux and incorporates C, C++ routins using their DLL. I don't know much about this. How to make DLL in Linux? If it is not posible, how to do it in Windows? The general questions I thing were addressed by Anders and Kai. In general, C and C++ are very easy. To create a Linux shared object (eg .so), compile forst to a .o using the -fpic option of the gcc (and g++) compiler. gcc foo.c -c -fpic This creates an object with position independent code (-fpic is not necessary in 32-bit, but is in 64-bit and on IA64 and other boxes). Then, to create the .so, gcc -shared -o libfoo.so foo.o
To use that library, you can either link with it: gcc prog.c -o prog -L . -l foo Or, in your program you can use the dlopen(2) and dlsym(2) system calls. These are relatively standard in Linux and Unix. -- Jerry Feldman <gerald.feldman@hp.com> Linux Expertise Center (PTAC-MA/TX) Hewlett-Packard Co. 200 Forest Street MRO1-3/K12 Marlborough, MA 01752-3081 508-467-4315 (http://www.testdrive.hp.com)