Problem using DLL written in C++

J

jliu1971

Hi,

I have written a DLL in C++ and was able to call it successfully from
a C++ program. However I am having a bit of problem calling it from a
Excel macro. The function is declared in the DLL as

extern "C" __declspec(dllexport) char* __stdcall SayHello(char
*infile);

and in VBA as

Declare Function SayHello Lib "TestHello.dll" (ByVal sin As String,
lenX As Long) As String

The SayHello function reads the lines from the input file, concat into
a long string and returns it as a char*. When the char* is shorter
than 20,000 the function runs fine. But when the file is large, I am
getting a gpf error. Is it becuase there is a limit on char*?

Thanks,
Jenn
 

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