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



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?

Nope.

There is no binary standard for compiled C++ code. Each compiler uses its
own binary layout.
This means that C++ code is incompatible between different compilers, and
even different compiler version.

Using Borland C++ dlls in msvc is not possible.

I think, that's not true. For example, I use a DLL written in Intel
Fortran with Borland C++. IMHO DLL-usage is compiler - and even though -
language independant. If it really doesn't work with the MS compiler (I
did not do this), it is in fact a Microsoft problem.

Not true.
The question is clearly about C++ classes that are exported from a dll.
Of course, dlls can be created with any C/C++ compiler.

But compiled C++ classes are NOT compatible between different C++ compilers.
This has nothing to do with Microsoft. It is a result from the fact that it
took a very long time for C++ to be standardized, while different vendors
went along, doing their own thing.

Borland is incompatible with microsoft is incompatible with gcc is
incompatible with icc is incompatible with ... as far as C++ classes are
concerned.

DLL usage itself is no problem. The problem is that what's inside that dll
is not a class as msvc would have compiled it.
Hence, it does not work.

--

Kind regards,
Bruno van Dooren
bruno_nos_pam_van_dooren@xxxxxxxxxxx
Remove only "_nos_pam"


.



Relevant Pages

  • Re: #pragma lib buggers everything up
    ... > derive the client application's classes from the classes in the lib, ... to link the final executable (be it an EXE or a DLL) and it turns out ... there's no problem discarding unused functions at this ... and derived class is very fragile - it depends on a particular compiler, ...
    (microsoft.public.vc.language)
  • Problem with Borland C++ 5.02
    ... I am developing an application for ISA DLL driver for some equipment ... LIB into the LIB path and directory of compiler, ...
    (comp.lang.c)
  • Problem with linking - cant find the right solution.
    ... I am developing an application for ISA DLL driver for some equipment ... LIB into the LIB path and directory of compiler, ...
    (comp.lang.c)
  • Re: Using python23 to develop an extension for an application that has python22 embedded
    ... > Distutils (MS CL non-optimising compiler, MinGW, ... problem using a DLL built with VC6 and another DLL built with VS.NET in the ... same application, but if you were to use a Borland or other compiler, then ...
    (comp.lang.python)
  • Re: Exposing bool to non-MS, non-C++ callers
    ... the functions in this DLL accept a structure as an argument. ... The compiler doesn't help catch places where I neglect ... the C++ bool type is defined as one byte. ... depends on whether the Exe caller will push a value larger than 1 byte. ...
    (microsoft.public.dotnet.languages.vc)