I'm trying to return a string from a C++ function to my VB app.
My VB IDE is crashing with an exception. Could someone point out what I'm doing wrong?
Code:// Header File #ifndef Main_H #define Main_H #ifndef TESTDLL #define TESTDLL __declspec(dllimport) #endif #include <string> using namespace std; TESTDLL string _stdcall GetName(); #endif // ------------------ // CPP File #define TESTDLL extern "C" __declspec(dllexport) #include <string> #include "test.h" using namespace std; TESTDLL string _stdcall GetName() { return "Works"; }I also have an appropriate exports.def file in my C++ project.Code:' Module Declare Function GetName Lib MyDLLPath As String ' cmdButton msgbox GetName
Any help is greatly appreciated.




Reply With Quote