I need to call a dll function written in Borland C++ Builder 6.0 from C# 4.0 application. I can succesfully call other functions from that dll, but not the desired one. The distinction of this function is that it shows VCL GUI windows. I suspect it is the problem because I succesfully call this function from C++ project. I even created my own C++ wrapper Dll that wraps my target BCB dll - the result is the same. I am constantly getting SEHException that means an internal exception in my Dll is thrown but I cannot detect what kind 开发者_如何学Pythonof because I cannot debug this dll.
Do you have any insights on this?
After playing with calling conversions with demo project I've found that SEHException is not thrown when you're incorrect with conventions and marshalling, you never get SEHException but memory/access exceptions.
Finally I've found the reason. It was very stupid.. If dll was called from folder containing "bin" string (the .NET case) then file was unable to be created and C++ Builder exception was thrown with SEH routine :) That's why calling from C++ was successful.
Brief summary:
SEH Exception means internal exception in your Dll. In C++ Builder all exceptions are based on this.
Try to debug original source even if you seem to be sure about what's happening.
精彩评论