Problem calling C DLL function from VBA

M

Maximus

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top