Solved

DLL function parameters

Posted on 2003-11-24
6
382 Views
Last Modified: 2010-04-01
Good-day,

I am attempting to load and run a function from a DLL using LoadLibrary and GetProcAddress.  I am able to find out the name of the functions within the DLL using Dependency Walker; but I am unable to find out the number of parameters and the type of parameters that each functions takes (ie float, UINT…).  How would I find out this info?

Thanks.
0
Comment
Question by:PastorDwayne
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 86

Expert Comment

by:jkr
ID: 9811276
>>but I am unable to find out the number of parameters and the type of parameters
>>that each functions takes (ie float, UINT…).  How would I find out this info?

Without a header file or any kind of documentation, there is hardly any chance to find out what arguments the functions take. Bad luck :-(

0
 
LVL 13

Expert Comment

by:SteH
ID: 9811349
Depends on whether the DLL as C++ mangled names. But if the function name has C++ mangling dependency walker will show you the function parameters automatically unless you see only the mangled name. Try hitting the C++ button. Otherwise accept jkr comment, no other chance.
0
 
LVL 86

Expert Comment

by:jkr
ID: 9811381
>>But if the function name has C++ mangling dependency walker will show you the function parameters

Only for simple data types. Sth. like

struct TheHellOfALotData {

// content goes here

};

int foo ( TheHellOfALotData*);

it'll come up with 'a pointer' at best...
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:PastorDwayne
ID: 9811703
Alright; Assuming one of the parameters is an array, how could this be passed to GetProcAddress? For an UINT I use

typedef UINT (CALLBACK* LPFNDLLFUNC1)(UINT);

What would the typedef be for an array on integers? Would a pointer have to be passed instead?
0
 
LVL 86

Accepted Solution

by:
jkr earned 125 total points
ID: 9811735
>>What would the typedef be for an array on integers?

typedef UINT (CALLBACK* LPFNDLLFUNC1)(UINT*);

>>Would a pointer have to be passed instead?

Yes, indeed. But, unless you are sure about what parameters the function takes, this is more than risky...
0
 

Author Comment

by:PastorDwayne
ID: 9811817
Thanks for your time.
0

Featured Post

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question