Author Topic: Export function with variable number of args  (Read 4077 times)

5k3l3t0r

  • Guest
Export function with variable number of args
« on: June 11, 2012, 04:15:53 AM »
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.

« Last Edit: June 11, 2012, 12:49:18 PM by hutch-- »

Tedd

  • Member
  • ***
  • Posts: 353
  • Procrastinor Extraordinaire
Re: Export function with variable number of args
« Reply #1 on: June 11, 2012, 07:47:08 AM »
C-style functions should have their exported names prefixed with underscore, try _myFunction ;)
Potato2

5k3l3t0r

  • Guest
Re: Export function with variable number of args
« Reply #2 on: June 11, 2012, 10:48:45 AM »
hi Tedd

i have tried what you suggest and have build errors :

Code: [Select]
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

  • Member
  • *****
  • Posts: 8734
  • Still using Abacus 2.0
    • DednDave
Re: Export function with variable number of args
« Reply #3 on: June 11, 2012, 10:59:39 AM »
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

  • Guest
Re: Export function with variable number of args
« Reply #4 on: June 11, 2012, 11:22:38 AM »
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

  • Member
  • *****
  • Posts: 8734
  • Still using Abacus 2.0
    • DednDave
Re: Export function with variable number of args
« Reply #5 on: June 11, 2012, 11:36:37 AM »
maybe you could make an example library and post the source
it would be easier than each of us writing a lib   :P