News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Export function with variable number of args

Started by 5k3l3t0r, June 11, 2012, 04:15:53 AM

Previous topic - Next topic

5k3l3t0r

hi all,

i have a static lib that export some functions, the problem comes wen i try to export a function that uses C calling convenction and  VARARG:



myFunction proto C :DWORD,:VARARG

.code
myFunction proc C param:DWORD,args:VARARG

ret
myFunction endp



the .def

LIBRARY myLibrary.lib
EXPORTS func1 @1 --------------->this work ok
               func2 @2 --------------->this work ok
               myFunction @3  ------> can't call this function


i must export that function in some diferent way?

bye

5k3l3t0r

PLEASE READ THE NO HELP DESK RULE. This is a forum of member, not a help desk. I have removed the [solved] from the title.


Tedd

C-style functions should have their exported names prefixed with underscore, try _myFunction ;)
Potato2

5k3l3t0r

hi Tedd

i have tried what you suggest and have build errors :


ReTool-2.0.def : error LNK2001: unresolved external symbol _RTCallModuleFunction
ReTool-2.0.def : error LNK2001: unresolved external symbol _RTLogMessageEx
ReTool-2.0.lib : fatal error LNK1120: 2 unresolved externals
LINK : fatal error LNK1141: failure during build of exports file


any other option?
tkx

5k3l3t0r

dedndave

you can see what the export names are by using something like dependency walker
or use one of Erol's tools - a number of ways to see what is exported by the lib

then - you will want a proper prototype
i suspect this is what may be missing

5k3l3t0r

without the underscore the lib compile ok, but the i can't use the function in my exe that import that lib,
wen i try to compile the exe get
"error A2006: undefined symbol : RTLogMessageEx"
all other functions without the c style work ok

if i add the underscore to the def file, the lib wont compile...

this is the name in the export table:

http://screensnapr.com/v/tlAvi6.png

tkx
5k3l3t0r



dedndave

maybe you could make an example library and post the source
it would be easier than each of us writing a lib   :P