Converting a dll / lib produced with Borland c to generate a dll - / lib which can be used with

Hi all,

what is the best way to Converting a dll / lib produced with Borland c to
generate a dll / lib which can be used with visual c v6 ?

Since posting this MSG I found this method, Is it correct and are there any
drawbacks with using this method

About as straightforward as rocket science. The problem is exporting
function names that MSVC can understand, and creating an MS import library.
You can’t use the LIB file generated by C++Builder in MSVC. To use a BCB
generated dll in MSVC, follow these guidelines

1- use the __cdecl calling convention instead of __stdcall (this is exactly
the opposite of the advice that you follow when creating a dll in MSVC that
you want to use in BCB) (see note at the end of this quote)

2- make sure you have an extern “C” {} around your function prototypes

3- You have to create a def file that aliases the function names. You need
to alias your exported symbols so they don’t contain a leading underscore.
The def file will look something like this

exports
SomeFunction = _SomeFunction

The easiest way to generate this def file is to first build the dll, then
run impdef on the dll to get a def file. That def file serves as a good
starting point.

4- Add the def file to your project.

5- rebuild

6- Now take the dll header file, the def file, and the dll to your MSVC
project directory

7- You need to create an MSVC import lib from the def file. Use microsoft’s
lib tool for this

lib /def yourdeffile.def

8- Add the LIB file created by lib.exe to your MSVC project.

Hopefully that will work. If you use __stdcall, things get ugly really fast.
BCB does not decorate __stdcall functions, but unfortunately, lib.exe can’t
handle undecorated __stdcall functions. You can export __stdcall functions,
but the process of generating an MSVC import library for it becomes
extremely messy.

[quote]

NOTE: if you want to use GetProcAddress instead of using an import library,
then it is easier if you switch to the __stdcall calling convention. It is
also easier to call your DLL from VB if you use __stdcall.

Hope this helps.

Harold Howe [TeamB]
http://www.bcbdev.com

Thanks
Robert Fernando
Anite Telecoms Ltd
110 Fleet Road
Fleet
Hampshire GU51 4BL
United Kingdom
Tel: +44 (0) 1252 775200
Fax: +44 (0) 1252 775 321
Email: xxxxx@anitetelecoms.com

Anite Telecoms Limited Registered in England No. 1721900 Registered
Office: 100 Longwater Avenue, GreenPark, Reading, Berkshire RG2 6GP,
United Kingdom


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com