Board index » cppbuilder » Export C++ class from a Borland DLL and use it in Microsoft VC

Export C++ class from a Borland DLL and use it in Microsoft VC


2006-09-28 06:37:32 PM
cppbuilder35
Hi All,
I'm new of this group and I do not know if this is the correct group
for my question.
I have a DLL with its export library (.lib) wrote in Borland C++ 6. In
borland everything is OK and I am able to include the lib and use the
class that i have exported creating an instance with new etc... I
would like to export this class in microsoft VC++ using the same .lib
file. Obviously it doesn' t work.
Is it possible to generate or convert the import library into a
compatible format?
Thank you in advance
Fabry
 
 

Re:Export C++ class from a Borland DLL and use it in Microsoft VC

As you have discovered the import library formats for Borland and for
Microsoft are not the same. There are three common ways in which a DLL
created by one compiler is used by an EXE or DLL created by another:
- create an import library from the DLL with the tools provided by
the compiler which created the using EXE or DLL
- create a module definition (*.DEF) file with impdef.exe and use
it in the link.
- create a module definition file and use the tools provided by the
the compiler which created the using EXE or DLL to create an
import library from that file
In general classes cannot be exported from a DLL except if the EXE or DLL
that uses the exported items is
- built with the same compiler
- built with the same compiler version
- depending upon the items in the class or its calling arguments,
with the same options settings.
The common ways a class in a DLL is used by an EXE or DLL created by a
different compiler is by exporting normal functions which use the class in
code internal to the DLL or by exporting providing a COM interface to use
the class.
. Ed
Quote
Fabry wrote in message
news: XXXX@XXXXX.COM ...

I'm new of this group and I do not know if this is the correct group
for my question.
I have a DLL with its export library (.lib) wrote in Borland C++ 6. In
borland everything is OK and I am able to include the lib and use the
class that i have exported creating an instance with new etc... I
would like to export this class in microsoft VC++ using the same .lib
file. Obviously it doesn' t work.

Is it possible to generate or convert the import library into a
compatible format?

Thank you in advance

Fabry
 

Re:Export C++ class from a Borland DLL and use it in Microsoft VC

Quote
Is it possible to generate or convert the import library into a
compatible format?
web.archive.org/web/20041013035035/www.bcbdev.com/articles/vcdll2.htm
This article explains how to export a class from VC++ to BCB. You might
be able to reverse some of the logic and make it work. COM is probably
your best bet.
web.archive.org/web/20041017020843/www.bcbdev.com/articles/bcbdll.htm
This article explains how to create a DLL in BCB that is called from
VC++. It only deals with plain C functions.
H^2
 

{smallsort}

Re:Export C++ class from a Borland DLL and use it in Microsoft VC

"Fabry" wrote:
Quote
I'm new of this group and I do not know if this is the correct group
for my question.
I have a DLL with its export library (.lib) wrote in Borland C++ 6. In
borland everything is OK and I am able to include the lib and use the
class that i have exported creating an instance with new etc... I
would like to export this class in microsoft VC++ using the same .lib
file. Obviously it doesn' t work.

Is it possible to generate or convert the import library into a
compatible format?

As it was said COM looks as the best option.
It is possible to avoid lot of the complexity
Microsoft added to COM over years.
If you use some other way it is recomended that
all executables use the same memory manager.
/Pavel