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



Bruno van Dooren [MVP VC++] wrote:
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.

Markus

This is not a Microsoft problem btw. It is true for all compilers. Microsoft even has a very good record for compatibility, gcc the worst.

If you want to export C++ code you have to stick with 1 compiler.
If you want to mix different compiler environments, you have to stay with ANSI C interfaces.

.



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: mex linker fails
    ... does this mean that the .lib is actually using the .dll? ... Try using "dependency walker" to look at the DLL. ... Matlab supported compiler for windows, so it's not straightforward to set up mex ... bash-3.1$ # Create import libraries ...
    (comp.soft-sys.matlab)