Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Borland .def alias not working

18 views
Skip to first unread message

Rhubarb

unread,
Aug 14, 2009, 8:21:43 AM8/14/09
to
The problem is .def aliasing of DLL functions is not working as
expected. I can get an alias in the DLL, but then the original
function name disappears.

I am trying to port a large Borland (C++ Release 5.0) C system to
MSVC. The current strategy is to compile the Borland main program(s)
in MSVC and have them call the Borland DLLs. Then port each DLL to
MSVC. So I am trying to use Example 1 in :-

http://web.archive.org/web/20030802140622/bcbdev.com/articles/bcbdll.htm#example1

The exported Borland DLL functions are EXPENTRY (=__stdcall) so I have
modified them to use __cdecl. There is a .def file which I have
modifed to add aliases (sans underscores) :
func ; __stdcall becomes instead
func = _func ; __cdecl with alias (format, alias
= _orig)

The .def is on the tlink32 (Turbo Link 1.6.71.0) command line as it
should be. Unfortunately the aliasing does not seem to work. I have
added 3 identical test routines to illustrate the problem, atest(),
btest() and ctest() like :

void
__cdecl __declspec(dllexport) atest();
void atest() { }

the .def file has :

EXPORTS
atest ; should cause a warning since atest
does not exist (but _atest exists)
_btest
ctest = _ctest

In Dependecy Walker I see :

_btest
ctest here is the new alias. good. but where is the
original function (_ctest)????
_atest exported cos of the __declspec(dllexport)

But I would expect to see :
_btest
_ctest original and
ctest alias
_atest

The aliased orginal (_ctest) disappears, but it should not. I need the
original function names while porting to make sure that the original
(pure borland) system builds and work despite all the changes I make
for the port.

This aliasing technique should "just work" but it has got me pulling
my hair out.

I would greatly appreciate any input on this

Peter Cutting

Rhubarb

unread,
Aug 17, 2009, 3:42:44 AM8/17/09
to
a solution is to do the following

EXPORTS
_afunc ; exports original func
afunc = _afunc ; exports alias


0 new messages