G
Guest
Hi there!
I’m having a strange problem with a c++ dll that is called from a c#
program. The dll wraps a large piece of c++ software that uses exceptions for
its error-signalling. To keep the exception mechanism away from the c# end,
all functions in the dll are embedded in catch-all blocks that return ‘false’
if anything throws an exception. Using a c++ program as the caller, the dll
can be shown to work and return false on an exception.
Now, the fun part: If I use c# to access the function, it returns ‘true’
every time an exception occurs. If I step into the dll, using the mixed-mode
debugger, the results are pretty interesting. Upon stepping over the line
that will case an exception to be thrown, the debugger jumps back to the c#
code, as if the function returned. It does not enter the exception handler,
like it did with c++ code calling the function.
I get this behaviour with all similar code.
FWIW, the DllImport lines look like this: [DllImport("somedll.dll",
CharSet=CharSet.Ansi)]
I would really appreciate some help, as this is a major showstopper for us.
Thanks in advance,
Ulf
I’m having a strange problem with a c++ dll that is called from a c#
program. The dll wraps a large piece of c++ software that uses exceptions for
its error-signalling. To keep the exception mechanism away from the c# end,
all functions in the dll are embedded in catch-all blocks that return ‘false’
if anything throws an exception. Using a c++ program as the caller, the dll
can be shown to work and return false on an exception.
Now, the fun part: If I use c# to access the function, it returns ‘true’
every time an exception occurs. If I step into the dll, using the mixed-mode
debugger, the results are pretty interesting. Upon stepping over the line
that will case an exception to be thrown, the debugger jumps back to the c#
code, as if the function returned. It does not enter the exception handler,
like it did with c++ code calling the function.
I get this behaviour with all similar code.
FWIW, the DllImport lines look like this: [DllImport("somedll.dll",
CharSet=CharSet.Ansi)]
I would really appreciate some help, as this is a major showstopper for us.
Thanks in advance,
Ulf