Connecting Tech Pros Worldwide Forums | Help | Site Map

Static library and Dynamic library

Newbie
 
Join Date: Oct 2007
Posts: 3
#1: Oct 5 '07
Hi

I have static library that is created from VC++.Net, however, I would like to use it in Borland C++ and I do any ways but it is not successful. So I want to ask: by the way can I use static library in Borland C++? Or can I change the static library into dynamic library? If the second way can be, can you tell me the ways?

If any ways above cannot do, please show me another way. Thanks alot.

Any instructions and any ideas are very great! I hope I will get the feedback as soon as posible!

Moderator
 
Join Date: Mar 2007
Location: North Bend Washington USA
Posts: 5,379
#2: Oct 5 '07

re: Static library and Dynamic library


You cannot use a library created by VC++ in a Borland project.

Or, more generally, you cannpot use a library compiled with a different compiler from the one you are using.

The reason is the name mangling required by C++ to resolve function overloads into unique function names for the compiler and linker. The C++ standard requires mangling occur but the algorithm for the mangling is left to the mental fantasies of the compiler writer.

You just have to compile the dll using the Borland compiler and all will be well.

If that'snot possible, then you can't use Borland.
Newbie
 
Join Date: Oct 2007
Posts: 3
#3: Oct 8 '07

re: Static library and Dynamic library


Thank you for your advice!

Since I am using ipl98 library version 2.20 that it cannot compile in Borland C++. So I must compile it in VC++.Net. But you tell me that if I compile in VC++.net, i cannot use that dll outside .Net enviroment.

However, I want to use ipl98 library version 2.20 in Borland C++ that I cannot compile it in Borland C++, can you give me other advices? Have you been used ipl98 library yet? If you have the experience that please help me! Thank you very much!

I will wait your advices or instructions!

Best regards
kukuta
Moderator
 
Join Date: Mar 2007
Location: North Bend Washington USA
Posts: 5,379
#4: Oct 8 '07

re: Static library and Dynamic library


Quote:

Originally Posted by kukuta

Since I am using ipl98 library version 2.20 that it cannot compile in Borland C++. So I must compile it in VC++.Net. But you tell me that if I compile in VC++.net, i cannot use that dll outside .Net enviroment.

Almost. What I said was a static library compiled by Visual Studio is generally not useable by another compiler, like Borland, due to name mangling.

Your orignal post referred to a static library.

DLLs are a little different. They are a relic from the C age of 1972 before C++ was invented. That means the function names in a dll must be unique. Like in C. So if the dll were compiled by Visual Studio, then it should be useable in Borland as long as its the same operating system.

However, do not expect a dll compiled using Windows to run on a Linux box.
Newbie
 
Join Date: Oct 2007
Posts: 3
#5: Oct 9 '07

re: Static library and Dynamic library


Hi weaknessforcats,

Thanks for your advices.

I means that if the dll or lib, which one I can use it in the Borland C++ is great. Since the ipl98 library version 2.20 cannot be compile in the Borland C++ successful(compiling successful but the dll and lib creating cannot run with example, it means unsuccessful compiling), so I must be compile ipl98 in the VC++.net to create dynamic library and static library. However, the dynamic library(dll) cannot run with the example of ipl98 library, just only static library(lib) can run with.

That is the reason I want to use static library in VC++.net to transition to dynamic library and after that using it in the Borland C++.

There are all what I want to ask you. Or you have another way to solve it. Please help me and give me emergency exit

How about is transition static library into dynamic library? This ways can we be successful?

Since I have no experience about dll and lib so I hope that you will show me step by step!

Thanks so much!

Best regards
Reply