How do I use a type from a DLL file?

88 views Asked by At

I have a DLL file without a header file, only sdk with code examples and function signatures. So I use LoadLibrary() to load my DLL: HINSTANCE myLibrary = LoadLibrary(_T("MyDLL.dll"));. Then I use GetProcAddress() to get pointers to the functions from the DLL: INITIAL initial = (INITIAL)GetProcAddress(myLibrary, "initial"); having used typedef beforehand: typedef int(__cdecl* INITIAL)(TCHAR*, INT);

Then I can finally use my functions and they work perfectly fine.

However I have stumbled upon functions that either return or use a custom data type as an argument:

UnfamiliarType myFunction1();
int myFunction2(UnfamiliarType arg);

How am I supposed to handle that if there is no information about this data type in sdk? If I get to know what fields this datatype has, do I also use typedef and GetProcAddress?

I suspect that the UnfamiliarType is some sort of an ID wrapper judging by its use, so if I had to guess, it might look something like UnfamiliarType(long id).

0

There are 0 answers