yami sukehiro
yami sukehiro

Reputation: 13

how to use getprocadderss to a struct or STL

I am pretty new to DLL:s and I've tried using a DLL with static link and dynamic link but this is my first time using runtime link (which uses LoadLibrary in order to access) and now I am trying to use my global std::vector in my client.exe is it possible to do GetProcAddress() to get this STL? or is it possible to GetProcAddress some struct that stored in DLL?

Upvotes: 0

Views: 59

Answers (1)

Nik
Nik

Reputation: 36

If the stl::vector is global to the application you can simply pass a reference to a function within the DLL.

If the stl::vector is global with respect to the DLL then you can have a function in the DLL return a reference to it. However, as stated already, if there is a chance the DLL and the application could be compiled using different versions of the STL then there is potential for issues, but you would probably be using a DLL compiled sometime in the past. Crossing C++ specs is most likely the main concern. If the application and the DLL are compiled at the same time then there is no concern.

Upvotes: 1

Related Questions