VB Callback function with string in VC DLL
-
Hello all, I am writing a DLL that wraps another DLL in an interface that can be called from VB. the dll ahs a callback function defined as typedef int(_cdecl *cbfuncText)(int HisNodeID, char *str, void *arg); In my wrapper DLL i have a function that translates this into a new Callbac function that is defined as typedef int(__stdcall *cbWfuncText)(int HisNodeID, char* str, void *arg); When i use the C string directly as shown here VB gets an empty string. when i try to use a BSTR instead, the VB program crashes. The VB function i use in the 2 situations are Function TextCB(ByVal HisNodeID As Long, ByVal str As String, ByRef arg As Long) As Long and Function TextCB(ByVal HisNodeID As Long, ByRef str As String, ByRef arg As Long) As Long Can anybody tell me what i am doing wrong? and/or give me suggestions of how to solve this? In Advance thanks Michael