Board index » cppbuilder » converting ms libs to borland libs using implib

converting ms libs to borland libs using implib

Hello

I have a dll created using MSVisualC. I want to use this dll in a BorlandC
application. I ran implib to create the Borland library file. It didn't work.
(unresolved external) Then I started searching through the newsgroups and then
figured out that I should run impdef to create the definition file. Make
changes on it. And then run implib on the definition file to create the
BorlandC library. However my problem is not the underscore or the extern c
problem. Below is only a part of the definition file.

LIBRARY     OSACADLL.DLL

EXPORTS
    ??0AssEntity@@IAE@G@Z          @1
    ??0AssEntity@@IAE@XZ           @2
    ??0AssEntity@@QAE@ABV0@@Z      @3
    ??0AssIsap@@QAE@ABV0@@Z        @4
    ??0AssIsap@@QAE@XZ             @5
    ??0AssOsap@@QAE@ABV0@@Z        @6
    ??0AssOsap@@QAE@XZ             @7
    ??0Baoc@@QAE@ABV0@@Z           @8
    ??0Baoc@@QAE@PBDPAVAssEntity@@@Z @9
    ??0CcoBaseClass@@QAE@ABV0@@Z   @10
    ??0CcoBaseClass@@QAE@KPBD0@Z   @11
    ??0CcoBaseClass@@QAE@KPBD@Z    @12
    ??0CcoEvent@@QAE@AAVCcoBaseClass@@KKKK@Z @13
    ??0CcoEvent@@QAE@ABV0@@Z       @14
    ??0CcoEvent@@QAE@PBD0AAVCcoBaseClass@@KKKK@Z @15
    ??0CcoEvent@@QAE@PBDAAVCcoBaseClass@@KKKK@Z @16

Instead of underscores I have question marks and numbers and also other
unnecessary characters at the end of object and function names.

As far as I understood I have to define an imports section and define the
aliases. But these are not functions. They are classes. How am I going to
define aliases for the inherited clasess etc...

Any suggestions or comments would be appreciated

Thanks

Cemile

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum

 

Re:converting ms libs to borland libs using implib


You cannot use C++-style interfaces between compilers. One reason is
incompatible name manling scheme ( there are others ). One thing you can
do is wrap your interface functions in extern "C" {}. Make sure both DLL
and its user have the same calling convention.

Alex

Quote
b...@ee.ubc.ca wrote:

> Hello

> I have a dll created using MSVisualC. I want to use this dll in a BorlandC
> application. I ran implib to create the Borland library file. It didn't work.
> (unresolved external) Then I started searching through the newsgroups and then
> figured out that I should run impdef to create the definition file. Make
> changes on it. And then run implib on the definition file to create the
> BorlandC library. However my problem is not the underscore or the extern c
> problem. Below is only a part of the definition file.

> LIBRARY     OSACADLL.DLL

> EXPORTS
>     ??0AssEntity@@IAE@G@Z          @1
>     ??0AssEntity@@IAE@XZ           @2
>     ??0AssEntity@@QAE@ABV0@@Z      @3
>     ??0AssIsap@@QAE@ABV0@@Z        @4
>     ??0AssIsap@@QAE@XZ             @5
>     ??0AssOsap@@QAE@ABV0@@Z        @6
>     ??0AssOsap@@QAE@XZ             @7
>     ??0Baoc@@QAE@ABV0@@Z           @8
>     ??0Baoc@@QAE@PBDPAVAssEntity@@@Z @9
>     ??0CcoBaseClass@@QAE@ABV0@@Z   @10
>     ??0CcoBaseClass@@QAE@KPBD0@Z   @11
>     ??0CcoBaseClass@@QAE@KPBD@Z    @12
>     ??0CcoEvent@@QAE@AAVCcoBaseClass@@KKKK@Z @13
>     ??0CcoEvent@@QAE@ABV0@@Z       @14
>     ??0CcoEvent@@QAE@PBD0AAVCcoBaseClass@@KKKK@Z @15
>     ??0CcoEvent@@QAE@PBDAAVCcoBaseClass@@KKKK@Z @16

> Instead of underscores I have question marks and numbers and also other
> unnecessary characters at the end of object and function names.

> As far as I understood I have to define an imports section and define the
> aliases. But these are not functions. They are classes. How am I going to
> define aliases for the inherited clasess etc...

> Any suggestions or comments would be appreciated

> Thanks

> Cemile

> -----== Posted via Deja News, The Leader in Internet Discussion ==-----
> http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum

Re:converting ms libs to borland libs using implib


In case it wasn't clear from Alex's message, you have to write those
interface functions using a compiler compatible with the one that created
the DLL (MSVC interface functions to MSVC++ DLLs, Symantec interfaces to
Symantec C++ DLLs, etc).  Also, the DLL that contains the interface
functions, and the DLL that contains the classes each have to be distributed
with the application.  You can make life a bit easier if you have the source
for the C++ DLL and just add the interface functions to it.  You can then
use conditional compiles to separate out the VC++ classes for non-VC++
clients.

Also, note that you can't export VC++ functions from a DLL into a VB
project, either.  This is really more of a compiler/language issue than a
vendor to vendor issue.

      Kevin

Quote
Alex Bakaev [TeamB] wrote in message <35B642AA.510A0...@jetsuite.com>...
>You cannot use C++-style interfaces between compilers. One reason is
>incompatible name manling scheme ( there are others ). One thing you can
>do is wrap your interface functions in extern "C" {}. Make sure both DLL
>and its user have the same calling convention.

Re:converting ms libs to borland libs using implib


In article <35B642AA.510A0...@jetsuite.com>,
  "Alex Bakaev [TeamB]" <al...@jetsuite.com> wrote:

Quote
> You cannot use C++-style interfaces between compilers. One reason is
> incompatible name manling scheme ( there are others ). One thing you can
> do is wrap your interface functions in extern "C" {}.

Which functions? The interface functions in the dll? Then it is impossible
because I don't have the code.

Quote
> Make sure both DLL and its user have the same calling convention.

I'm trying to define aliases in the .def file. Is this what you mean?

Thanks for suggestions

Cemile

Quote

> Alex

> b...@ee.ubc.ca wrote:

> > Hello

> > I have a dll created using MSVisualC. I want to use this dll in a BorlandC
> > application. I ran implib to create the Borland library file. It didn't
work.
> > (unresolved external) Then I started searching through the newsgroups and
then
> > figured out that I should run impdef to create the definition file. Make
> > changes on it. And then run implib on the definition file to create the
> > BorlandC library. However my problem is not the underscore or the extern c
> > problem. Below is only a part of the definition file.

-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp   Create Your Own Free Member Forum

Re:converting ms libs to borland libs using implib


Quote
b...@ee.ubc.ca wrote in message <6p5rd9$sr...@nnrp1.dejanews.com>...
>In article <35B642AA.510A0...@jetsuite.com>,
>  "Alex Bakaev [TeamB]" <al...@jetsuite.com> wrote:

>Which functions? The interface functions in the dll? Then it is impossible
>because I don't have the code.

You can't access the classes/functions in the DLL because you are not using
MSVC to access them.  There is no way to make other vendors' compilers
interface with straight C++ class functions.  If you have access to MSVC,
then you can write a DLL of exported extern "C" functions that will access
the C++ DLL and provide interfaces to other compilers and languages.

Quote
>> Make sure both DLL and its user have the same calling convention.

>I'm trying to define aliases in the .def file. Is this what you mean?

No.  Aliases won't help.  They may allow you to get past the undefined
symbols errors, but there may be other, more subtle, yet more dangerous,
errors that crop up in the run-time usage.  Depending on the calling
conventions (__stdcall or __cdecl) that you use in your interface DLL, you
may have to modify the DEF file to get the names to match up, but the
calling conventions will match properly.

Essentially, what you need to do is create a DLL that would do the things
that your BCB code was wanting to do with the C++ DLL.  You would then use
the resulting DLLs LIB file in your BCB project, and distribute both DLLs
with your application.

Kevin

Other Threads