I'm not even sure if this is actually considered 'Shared Memory', and
that's partly why Googling this particular problem of mine has failed
me for the most part. Please read the following and maybe you can
determine the problem I'm trying to solve, and possibly point me in
the right direction:
I have an application, and a DLL. The application was linked to the
DLL via a .lib file, and was accessing the exported functions just
fine. One particular example of the relationship was this:
void _stdcall GetHosts(vector<string> * vszHostsD);
// In which the DLL would require a pointer to a vector<string> as
input, and modify its contents.
// And the application would call this function in the appropriate
way:
vector<string> * vszHosts;
GetHost(vszHosts);
MessageBox(...vszHosts.at(0).c_str()...); // The contents of the
vector were filled correctly
Then I noticed that on certain systems (particularly, WinXP SP1), the
program failed to run. So I researched a bit, and found two
solutions. 1. Add the msvc8 DLLs to my distribution, and 2. change my
compiler's configuration. I opted for the latter, because my program
is written entirely in Win32 API and meant to be a very small
executable. My original configuration was this:
Configuration Properties -> C/C++ -> Code Generation -> Runtime
Library == /MD
I followed some advice, and changed this value to /MT
Now, the program runs on other systems, but occasionally crashes when
the DLL functions are called. When debugging on my system (WinXP
SP2), the application always breaks. It looks like its having trouble
allocating memory correctly, or more likely, modifying memory from the
calling process. I suppose this makes sense.
I am not entirely sure if this qualifies as a 'Shared memory' problem,
but basically I'd like those 3 lines of code above to work, on all
systems, without needing to include any extra files. Code changes and
compiler configurations are not a problem at all.
Can anyone point me in the right direction? Thanks in advance,
Jimmie Tyrrell