Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access Struct within DLL

Status
Not open for further replies.

adamfairs8110

Programmer
Sep 29, 2003
2
GB
Hi,

I'm having problems accessing a struct in a dll file using C++.

I have successfully loaded the DLL, and loaded and called some of the functions using LoadLibrary and GetProcAddress. However, there is an insert function that I am having difficulties with that requires a struct to be passed into it. This struct is defined within a file in DLL and must be populated before passed to the insert function.

I've looked for a similar function to GetProcAddress to use. I've also tried including the file within the DLL that defines the struct.

This one's got me completely banjaxed.

I'd appreciate any help at all.

Thanks,

Adam
 
This should really work by having the struct declared within a class and you should be able to create an instance of the class (thereby providing you with an offset pointer which you can use to address the struct).

If this is not the case (i.e. the struct is declared loose) and the struct is not in the export table (has not been declared as an export) then I think you are stumped as I don't see any way to address the struct information within the DLL.

Be curious to know if the latter is the case and you find an answer..
 
Hi, thanks for the response,

This is the first time I've worked with a DLL in C++ so I'm not to sure whether the struct is in the export table. How do I find out?

I've had a response from another forum to simply include the file the struct is in (contained in the DLL). To be honest I didn't even consider a simple solution. Does this seem right to you? I've tried this but it seems to include the file but says another file is missing. So after I get this other file I'll let you know how it goes.

Thanks for your help.

Adam
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top