how to use a dynamical linked library in C++ program in Linux


 
Thread Tools Search this Thread
Top Forums Programming how to use a dynamical linked library in C++ program in Linux
# 1  
Old 05-07-2007
how to use a dynamical linked library in C++ program in Linux

I have a dynamically linked library, providing some functions needed in my project. I have successfully imported it into my VC ++ 6.0 project. Now, i am translating the project into pure C++ (such as avoiding using MFC classess) in Linux box.


Does anyone know if it makes sense to try to use the library in Linux.

Thanks
# 2  
Old 05-07-2007
These are some introductions of "shared object".
http://www-128.ibm.com/developerworks/library/l-shobj/
http://www.linux.com/howtos/Program-...ibraries.shtml
http://www.faqs.org/docs/Linux-HOWTO...ary-HOWTO.html

Best regards,
Iliyan Varshilov

Last edited by ilko_partizan; 05-07-2007 at 04:59 AM..
# 3  
Old 05-07-2007
I have an issue with using C++ in shared libraries and exposing name mangled exports. There is no problem with using C style exports and having the interface to the library follow C constaints and using C++ internally within the library.

C++ suffers from a number of limitations such as the fragile base class problem, non standard name mangling schemes, different vtable layouts between compilers that prevent it being a true language for components.

There can also be problems with C++ in shared libraries if loaded by an application written in C or a different C++ compiler due to initialisation of static objects not working.

How are you intending to write/generate your 'export' file?
Login or Register to Ask a Question

Previous Thread | Next Thread

5 More Discussions You Might Find Interesting

1. Homework & Coursework Questions

create a program that runs two processes linked oven

I need help program in C... :create a program that runs two processes linked oven (1 Reply)
Discussion started by: gizmo16
1 Replies

2. Programming

dlopen failing on library with statically linked dependencies

I am attempting to port a program from OS X to Linux. It's C++ & Qt Creator and I did the original Windows to OS X port, so I tried to make it as POSIX-compliant as possible; the OS X port works well, and the Linux port builds and starts (it's on Ubuntu 9.10) but has some issues running. The... (2 Replies)
Discussion started by: Hodapp87
2 Replies

3. Linux

change the memory address of ld.linux-so in a dynamically linked process

hi, For some special reason , I'd like to control the memory address for the shared libraries in my dynamically linked process. And it is the "ld" which interpret the dynamically linked library, and in my system, the "ld-linux.so.2" is put at 0x00812000. Then I use "prelink -r" command to... (3 Replies)
Discussion started by: zerocool_08
3 Replies

4. UNIX for Dummies Questions & Answers

change the memory address of ld.linux-so in a dynamically linked process

hi, For some special reason , I'd like to control the memory address for the shared libraries in my dynamically linked process. And it is the "ld" which interpret the dynamically linked library, and in my system, the "ld-linux.so.2" is put at 0x00812000. Then I use "prelink -r" command to change... (0 Replies)
Discussion started by: zerocool_08
0 Replies

5. Programming

HOw to load dynamic lib from a statically linked program ?

I need to load a dynamic library from a statically linked program. Is there a way without recompiling my program. when i try to do that my program just crashes. If not possible, how can I avoid crashing the program when i try to load the dynamic lib, again without recompiling. If my... (1 Reply)
Discussion started by: disclaimer
1 Replies
Login or Register to Ask a Question