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

forwarding exports by ordinals

366 views
Skip to first unread message

nonam...@hotmail.com

unread,
Aug 3, 2001, 7:00:43 AM8/3/01
to
i'm writing a wrapper DLL - export all functions as the original DLL,
but trying to keep my DLL minimal I forward all functions that I'm not
interested in.
(I build export library (you know - DUMPBIN and then LIB /DEF) for the
original DLL to link with my wrapper Dll in order to invoke original
functions. )

my DEF file is..

LIBRARY WRAP
EXPORTS
func1 = ORG_DLL.func1 @1
func2 = ORG_DLL.func2 @2
func3 @3

if exports by ORG_DLL was made by name - everything is ok. but in my
case exports from ORG_DLL are made by ordinal
so I put in DEF file
func1 = ORG_DLL.1 @1
but get linker error :error LNK2001: unresolved external symbol 1

I tried func1 = ORG_DLL.#1 @1
:error LNK2001: unresolved external symbol func1

interesting if
func1 = ORG_DLL.@1 @1

links ok. - but at loadtime OS cannot find @1 function- I turned on
Loader snaps with GFlags Utility, and saw that Loader is tryng to find
function in org_dll.dll BY NAME, instead by ordinal... huh! well
symbol '@' is a correct part of function name.
I used hex editor, and patch my wrapper DLL so forward that appears as
ORG_DLL.@1 - a changed to ORG_DLL.#1 .. well it works!!!
is this a linker bug, or I'm doing something wrong?

so.. how to forward by ordinals?

(linker version 6.00.8447 - Visual C 6.0 SP5)

Jeff Partch

unread,
Aug 3, 2001, 8:08:52 AM8/3/01
to
Hi!

It's been a while so I may be wrong, but old code and notes indicate this *def file syntax...

EXPORTS
FwdExpFunc4 @4=ORG_DLL.@4 NONAME

...and if that works, the #pragma version goes something like...

#pragma comment(linker, "/EXPORT:_FwdExpFunc4,@4=ORG_DLL.@4,NONAME")

My notes seem to say that if you don't know the name of the original function you can just make one up (like above) for internal
use, or otherwise just use the original name. My notes must have made more sense at the time though. Anyway, maybe somebody else
knows for sure.

HTH,

Jeff...
--
Please post all follow-ups to the newsgroup only.

0 new messages