The DLL runs in the same address space as your application
So write some function in your Dll, say Give(void *);
and call this function from your applicatin after LoadLibrary call, pass your struct * to Give(void*).
I'm not sure to understand.
Assuming this simple
struct MyStruct
{
int Int;
float flt;
};
and this elementary function in the dll
void DoSomething(void* pv)
{
pv->Int += 3;
pv->flt *=3.14;
}
could you please show me the full code to pass an instance of MyStruct to the dll?
I know already how to use AfxLoadLibrary and GetProcAddress: my problem is how to pass a void pointer to and fro without raising errors and/or exceptions.
forget about AfxLoadLibrary and GetProcAddress. When you compile a dll, you get as result a .lib and a .dll. Just compile your .exe with .lib resulted in from compiling your .dll. In .exe project use the same headers what you use in .dll.
for your exe you should declaer structure like:
struct __declspec(dllimport) MyStruct
{
int Int;
float flt;
};
for your .dll:
struct __declspec(dllexport) MyStruct
{
int Int;
float flt;
};
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.