IonelBurtan
Programmer
I have build a MFC DLL with 2 exported functions like this:
#define EXPORTED extern __declspec(dllexport)
EXPORTED LRESULT SetEnviron(LPCSTR strEnviron)
EXPORTED long GetEnviron(LPSTR strEnviron)
In VB I have the 2 declarations:
public declare sub SetEnviron lib "parser.dll"(ByVal strEnviron as String)
public declare function GetEnviron lib "parser.dll"(ByRef strEnviron as String) as Long
The body of the functions is dummy so I don't include them here. The problem is the first function(a simple setter), works just fine, but the second one fails with the following simptoms:
1. When I run the executable that call the function GetEnviron from inside VB I get error no 49 "Bad Dll calling convention"
2. When I run the executable that call the function GetEnviron from outside VB I get an error like "The memory cold not be read" then the program crushes.
3. When I run the executabile by debuging the DLL from VC++ line by line,I see that my function executes fine, puts the result in the byref passed argument, then after the last line of the function(return 0L it crushes with error "OLEOUT32 Access Violation".
#define EXPORTED extern __declspec(dllexport)
EXPORTED LRESULT SetEnviron(LPCSTR strEnviron)
EXPORTED long GetEnviron(LPSTR strEnviron)
In VB I have the 2 declarations:
public declare sub SetEnviron lib "parser.dll"(ByVal strEnviron as String)
public declare function GetEnviron lib "parser.dll"(ByRef strEnviron as String) as Long
The body of the functions is dummy so I don't include them here. The problem is the first function(a simple setter), works just fine, but the second one fails with the following simptoms:
1. When I run the executable that call the function GetEnviron from inside VB I get error no 49 "Bad Dll calling convention"
2. When I run the executable that call the function GetEnviron from outside VB I get an error like "The memory cold not be read" then the program crushes.
3. When I run the executabile by debuging the DLL from VC++ line by line,I see that my function executes fine, puts the result in the byref passed argument, then after the last line of the function(return 0L it crushes with error "OLEOUT32 Access Violation".