I'm a little bit confused with GetProcAddress()
.
Quoting the Win32 docs:
If the function succeeds, the return value is the address of the exported function or variable.
I know that for functions, GetProcAddress()
returns a function pointer that calls the desired function. However, it isn't clear what GetProcAddress()
returns in something like this:
DLL code
typedef struct {
uint64_t foo;
double bar;
char* baz;
} MyStruct;
__declspec(dllexport) MyStruct* my_struct_ptr;
__declspec(dllexport) long long special_global;
Application code
void* my_struct_ptr = GetProcAddress(my_dll_handle, "my_struct_ptr");
void* special_global = GetProcAddress(my_dll_handle, "special_global");
What would my_struct_ptr
and special_global
in the application point to?
EDIT: Does my_struct_ptr
point to the DLL's my_struct_ptr
or the struct that the DLL's my_struct_ptr
points to?