How to link Borland code with Microsoft DLLs

(the Tcl way)

Introduction

It's always a big hassle to link Borland code with Microsoft DLLs. Fortunately there are some Borland gurus out there furnishing helpful background information on the process (eg. see www.bcbdev.com, and the articles section there).

If you want to link with any DLL you need a .LIB file. Among others it tells the linker which functions are contained within the library. Now if you build a DLL using your Borland compiler, you can optionally have the linker create a corresponding .LIB file at the same time. So you never have a problem to link with your own DLLs.

If you got a "foreign" DLL, you can use a tool from Borland called IMPLIB to create the required .LIB file from it. Basically this works - but it does not work 100% if it is a Microsoft DLL and some additional conditions hold (for details see the URL above). As reality will have it though, more often than not you will be confronted with those "additional conditions".

However there is another way to get IMPLIB to generate a .LIB file for you: You tell it explicitely

That is you give each function in the DLL an alias name and - the nice part - you do it with a plain text file.

 

alias.tcl and mk_alias.bat

You could of course write this text file yourself - but why bother, if a little Tcl script can do this job for you ? That's what alias.tcl is for. The greater part of this file is documentation, so you should not have any difficulties in using it. In particular there should be no need to modify this script - unless it contains some as yet undetected error, of course.

For ease of use I have added a small batch file (mk_alias.bat), which further simplifies the whole process, so you might want to look there first. You can get the two together in a zip file.

 

Final remark

I created this page - and the two files mentioned above - in the context of combining Tcl and C/C++ using Borland tools. Tcl is a powerful scripting language (www.scriptics.com), which has truly remarkable features - not the least of which is the support one can find at comp.lang.tcl.

If this combination is of interest for you, too, you can find further information here.


Let's see, how many users are interested in this topic. You are visitor 11368 since Dec. 4, 2000.

Things change fast these days. Want to be informed if changes had been necessary (bugs discovered, new version of ...)  or additional material is available (e.g. not only C & Tcl, but also VCL & Tcl) ?

Version info: All examples (if applicable) are based on Tcl/TK 8.3.2, Borland C++ 5.5 (or C++ Builder 5) and MkTclApp 3.9.

Home   Top  

Copyright © Helmut Giese, email: hgiese@ratiosoft.com
Parkstr. 41, 34119 Kassel, Tel.: 0561 - 766 59 50, Fax: 0561 - 766 59 51
Königstor 59, 34119 Kassel, Tel.: 0561 - 739 35 30, Fax: 0561 - 739 35 31

Web Design von Bianca Engler:   email    internet