Author Topic: How to use a DLL created by Borland C++ Builder 6?(RESOLVED)  (Read 12812 times)

Offline kingfox

  • Multiple posting newcomer
  • *
  • Posts: 41
How to use a DLL created by Borland C++ Builder 6?(RESOLVED)
« on: October 22, 2006, 11:44:22 am »
I'm using C::B 1.0RC2 the newst nightly build and using MinGW 3.4.4 integrated within C::B.

I created a DLL named bcdll.dll by Borland C++ Builder 6. And I use followed command to generate a import library used by C::B :
   pexports bcdll.dll > bcdll.def
   dlltool -d bcdll.def -l bcdll.a
and dlltool tell that "dlltool: Syntax error in def file bcdll.dll:0".

How can I do to resolve this problem ?

The content of bcdll.def is:
Code: cpp
LIBRARY bcDll.dll
EXPORTS
@@Bcdllfunc@Finalize
@@Bcdllfunc@Initialize
@showMessageBox$qpxc
___CPPdebugHook DATA
« Last Edit: October 23, 2006, 02:09:44 pm by kingfox »

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: How to use a DLL created by Borland C++ Builder 6?
« Reply #1 on: October 22, 2006, 02:14:25 pm »
I'm using C::B 1.0RC2 the newst nightly build
Those are two mutually exclusive things.
However, it doesn't matter in this case, since it is not strictly a Code::Blocks related problem, but a compiler-related problem.

The def file that you posted contains two notable things:
1. CPP
2. double-underscores

First of all, sharing C++ libraries between different compilers is problematic at best, as they have different ABIs. You should make everything extern "C" if you want to have any chance to do cross-compiler acrobatics at all. That will force function calls to something every compiler does the same way.

Second, those double-underscores are a known issue when converting Microsoft DLLs to MinGW.
I don't know whether you can use Borland libraries in gcc at all, but these double-underscores are practically guaranteed to be the same issue as with Microsoft Dlls. The "cookbook" way to get rid of them would be pexports cbDll.dll | sed 's/^_//' > cbDll.def, as found on Mark Schoenberg's site.

If nothing helps, you may have to go through a more painful process, by editing the def file by hand to the correct format.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2750
Re: How to use a DLL created by Borland C++ Builder 6?
« Reply #2 on: October 22, 2006, 02:43:07 pm »
The "cookbook" way to get rid of them would be pexports cbDll.dll | sed 's/^_//' > cbDll.def, as found on Mark Schoenberg's site.

The site was hard to find. So I'm posting it...
http://www.emmestech.com/software/cygwin/pexports-0.43/moron1.html

Offline kingfox

  • Multiple posting newcomer
  • *
  • Posts: 41
Re: How to use a DLL created by Borland C++ Builder 6?
« Reply #3 on: October 23, 2006, 02:09:14 pm »
Thank's for Thomas' and Pecan's answer. Now this problem is resolved. Thank you very much. :lol: