[Mono-bugs] [Bug 74593][Maj] New - P/Invoke problem with function name decoration

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Wed, 13 Apr 2005 12:59:01 -0400 (EDT)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by sebastien.robitaille@croesus.com.

http://bugzilla.ximian.com/show_bug.cgi?id=74593

--- shadow/74593	2005-04-13 12:59:01.000000000 -0400
+++ shadow/74593.tmp.29335	2005-04-13 12:59:01.000000000 -0400
@@ -0,0 +1,62 @@
+Bug#: 74593
+Product: Mono: Runtime
+Version: 1.1
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Major
+Component: misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: sebastien.robitaille@croesus.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: P/Invoke problem with function name decoration
+
+Description of Problem:
+
+On Windows, when a C function is exported from a DLL with the __stdcall 
+calling convention, its name is decorated:
+
+ex:
+"_MyFunction@0" instead of "MyFunction"
+
+When calling this method from a managed application using P/Invoke, an 
+exception is thrown with Mono (on Windows) but not with MS.NET.
+(See attached test-case).
+
+MS.NET does find the function in the DLL even if its name was decorated.
+Mono doesn't.
+
+Steps to reproduce the problem:
+1. Call build.bat to compile the test-case.
+2. Run Tester.exe with both MS.NET and mono on Windows
+
+Actual Results:
+With Mono:
+MyFunction result:
+42
+MyFunctionWithStdCall result:
+
+Unhandled Exception: System.EntryPointNotFoundException: 
+myFunctionWithStdCall
+in <0x00049> (wrapper managed-to-native) 
+MonoCallingConventionTester.Tester:myFunctionWithStdCall ()
+in <0x00029> MonoCallingConventionTester.Tester:Main (string[])
+
+
+Expected Results:
+With MS.NET:
+MyFunction result:
+42
+MyFunctionWithStdCall result:
+42
+
+How often does this happen? 
+Always.
+
+Additional Information:
+Mono-1.1.4 on Windows XP.