Libraries conflict

Hi Friends,

I have one c++ application which requires some libraries, and I have another application in which I want to use first application + libraries which are used in first application (but versions are different), if I use both of them together I get conflicts.

Can I create .so file of first application and use this in 2nd application ?
I got the information that .so file can help me on this.

Please help me on this.

Thanks & Regards,
Udit Kumar
I'm no expert, and there's probably a nicer way to do it, but if you're on Windows you could compile the first application as a *.dll with the appropriate methods (i.e. the ones you want to call from the second application) exposed using DllExport (you can check the success of this by loading the dll with the dependency walker program).

You could then use DllImport in the second application to use this dll and access the methods of the first.

I must stress that I'm no expert on this though. I write this because I have done it this way in the past and it worked fine. I'd love to hear other solutions (especially non-Windows ones) if there's a neater way to do it...
He is on Unix, so the Windows stuff won't help.

Will the first application not work with the later version of the library?

What exactly do you mean by "create .so file of first application"? If you mean turning the first application into a library itself that will require a bit of work -- much more work if you don't have access to the first application's source code.

[edit]
A simple option would be to simply have the second program execute the first as a child process communicating with an appropriate pipe or some other form of IPC.

Your second application can explicitly link to a differently-named version of the library. Common on Unix is stuff like:

libfoo.so
libfoo.so.2
libfoo.so.2.1
libfoo.so.3

etc.
Last edited on
Topic archived. No new replies allowed.