std::map and DLL functions
Posted on 2002-03-20
When using std::map as an argument passed to a dll, I always get an access violation. I've now resorted to the simplest of programs, but still can't work it out... Here's a snippet:
/* ========= .dll file =============== */
using namespace std;
typedef map< int, int > Map;
extern "C" __declspec( dllexport ) void Test( Map & m )
//keep getting access violations as soon as I try to use m
int i = m;
int j = m;
/* ======== .exe file =================== */
The .exe file is a very simple main() which calls Test() with a map it creates. I get the access violation whether I link dynamically using "LoadLibrary()" or statically by linking with the .lib.
Any comments will be greatly appreciated.