?
Solved

Use a DLL without a header file

Posted on 2003-02-19
4
Medium Priority
?
232 Views
Last Modified: 2013-12-03
Is there anyway I can find the parameters and or return value of a function in a dll without the header file.  I want to use a dll and don't have access to the header file of library file.

0
Comment
Question by:dirtywerm
[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
  • 2
4 Comments
 
LVL 12

Accepted Solution

by:
pjknibbs earned 200 total points
ID: 7985890
Well, yes and no. You can find out the names of the functions the DLL exports by using DUMPBIN (Visual C++) or a similar tool--unfortunately there's no information stored in the DLL about what parameters its functions take or what their return values are (unless the DLL in question is actually a COM component, in which case you access it in a completely different way in any case).
0
 
LVL 6

Expert Comment

by:PlanetCpp
ID: 7985906
of course, you use loadlibrary. you need to know the name of the function , but you should know that anyway...
you use loadlibrary and save the HMODULE. the use GetProcAddress pass it the hmodule and the name of the function exactlly (maybe also try an alias if this returns NULL, check all returns before you use any pointers) you can create a pointer to the function like so
let's say the function returns long and take two integer parameters:
typedef long (WINAPI *_MyDllFunction)(int,int);
_MyDllFunction MyDllFunction;
set MyDllFunction = (_MyDllFunction)GetProcAddress(hmodulehere,"MyDllFunction");
assuming the address was returned correctlly you call it as normal:
somelong = MyDllFunction(5,5);
thats all.
0
 
LVL 6

Expert Comment

by:PlanetCpp
ID: 7985909
i read your question wrong, but it can apply after you get the answer ;o\
0
 

Author Comment

by:dirtywerm
ID: 8251570
Yeah, i figured there wasn't any way to do it. Its not a com component.

Thanks
0

Featured Post

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Question has a verified solution.

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

zlib is a free compression library (a DLL) on which the popular gzip utility is built.  In this article, we'll see how to use the zlib functions to compress and decompress data in memory; that is, without needing to use a temporary file.  We'll be c…
This article surveys and compares options for encoding and decoding base64 data.  It includes source code in C++ as well as examples of how to use standard Windows API functions for these tasks. We'll look at the algorithms — how encoding and decodi…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

752 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