
Signature
Greetings
Jochen
My blog about Win32 and .NET
http://blog.kalmbachnet.de/
Hi Jochen,
There is something more sinister going on.
strcpy(test,ca_LastConfigError());
strcpy(sOutput,test);
return;
single stepping through the above executes you can see that sOutput in the
locals windows has "Oracle error blah blah"
you can then single step to the return OK
when you single step again up into the VB Calling method you get an error
'An unhandled exception of type 'System.ExecutionEngineException' occurred
in Monitor.exe'
Seeing that the VB code and the VC++ code are both inside try catch blocks I
guess the error is somewhere in between the two.
if you can spot the problem I would be grateful.
Thanks
Bob
*********VB.net Calling code START************
Public Function LastConfigErrorMessage() As String
Try
Dim sb As New StringBuilder
sb.Capacity = 256 ' Desperation
sb.Length = 256 ' likewise
LastConfigError(sb)
Return sb.ToString
Catch ex As Exception
WriteErrorLog("DNP3Config.LastConfigErrorMessage " & ex.Message)
End Try
End Function
*************VB Code END************
*****VC++ code START***************
void DNPCONFIG_API LastConfigError(char *sOutput)
{
try
{
char test[255];
//strcpy(test, ca_LastConfigError());
//MessageBox(NULL,test,"",0);
strcpy(test,ca_LastConfigError());
//sOutput= ca_LastConfigError();
//MessageBox(NULL,test,"",0);
strcpy(sOutput,test);
//MessageBox(NULL,sOutput,"",0);
return;
}
catch (char * str)
{
char error[255];
strcpy(error,str);
MessageBox(NULL,error,"",0);
}
}
************VC++ CODE END******************
> Hi Bob!
>
[quoted text clipped - 23 lines]
>
> void DNPCONFIG_API LastConfigError(char *sOutput, size_t nMaxLen)
Bob - 24 Jun 2005 03:44 GMT
Hi Jochen,
Solved it.
The library declaration of the string builder was byRef it should have been
by Val.
Thanks
> Hi Jochen,
> There is something more sinister going on.
[quoted text clipped - 112 lines]
> >
> > void DNPCONFIG_API LastConfigError(char *sOutput, size_t nMaxLen)