BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

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

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Compatibility with MFC)
View previous topic :: View next topic  
Author Message
Fabry
Guest





PostPosted: Thu Sep 28, 2006 3:37 pm    Post subject: Export C++ class from a Borland DLL and use it in Microsoft Reply with quote



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
Back to top
Ed Mulroy
Guest





PostPosted: Thu Sep 28, 2006 6:26 pm    Post subject: Re: Export C++ class from a Borland DLL and use it in Micros Reply with quote



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:1159439852.118518.47110 (AT) m73g2000cwd (DOT) googlegroups.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
Back to top
Harold Howe [TeamB]
Guest





PostPosted: Mon Oct 02, 2006 9:14 pm    Post subject: Re: Export C++ class from a Borland DLL and use it in Micros Reply with quote



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

http://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.

http://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
Back to top
Pavel Vozenilek
Guest





PostPosted: Wed Oct 04, 2006 6:57 pm    Post subject: Re: Export C++ class from a Borland DLL and use it in Micros Reply with quote

"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
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Compatibility with MFC) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.