View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Vorreiter Johann \(IFDA\) Vorreiter Johann \(IFDA\) is offline
external usenet poster
 
Posts: 2
Default Calling a C++ DLL which returns a String

Hi,

following problem:
in my EXCEL VBA-code I try to call a function from a C++ DLL which has the
following declaration:

long TestFunc( char* TestStr );

In this function the TestStr is modified.

VBA-code:

Declare Function TestFunc& lib "TestDll.dll" ( VBAString as String )

Dim DummyStr as String
DummyStr = "this is a test"
ret = TestFunc( DummyStr )

BUT, after calling TestFunc EXCEL crashes...
As long as I don't touch the string in the C++ funtion everything is ok.

Any other idea how to return a string from a DLL?


Thanks,

Johann