I need to call a DLL function from Access using VBA. The prototype for the DLL function is
int __stdcall myFunction(const char* data,
int rows, int cols, int sl, int fullsize,
double aspect_ratio,
double y,
void** ppResult);
The one I declared in Access:
Private Declare Function DllImport_myFunction _
Lib "myFunctionDLL.dll" _
Alias "myFunction" _
(ByVal data As String, _
ByVal rows As Long, _
ByVal cols As Long, _
ByVal sl As Long, _
ByVal fullsize As Long, _
ByVal aspectRatio As Double, _
ByVal y As Double, _
ByRef handle As Long)
When I try to call from Access, Access crashed with an access violation. I placed a breakpoint in the first statement of the DLL function, but it was not hit.
Is the declaration incorrect?
You are missing the return
and probably need to add extern "C" to avoid mangling.