[Mono-bugs] [Bug 63130][Blo] New - P/Invoke fails to resolve platform specific prefixes and suffixes
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Mon, 16 Aug 2004 06:40:55 -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 infodate@aster.pl.
http://bugzilla.ximian.com/show_bug.cgi?id=63130
--- shadow/63130 2004-08-16 06:40:55.000000000 -0400
+++ shadow/63130.tmp.13537 2004-08-16 06:40:55.000000000 -0400
@@ -0,0 +1,104 @@
+Bug#: 63130
+Product: Mono: Class Libraries
+Version: unspecified
+OS: SUSE 9.1
+OS Details: Pro all patches applied
+Status: NEW
+Resolution:
+Severity: Unknown
+Priority: Blocker
+Component: CORLIB
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: infodate@aster.pl
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: P/Invoke fails to resolve platform specific prefixes and suffixes
+
+Description of Problem:
+
+In some situations P/Invoke call fails with DllNotFoundException.
+
+
+Steps to reproduce the problem:
+
+On SuSE 9.1 Pro
+
+glue.cpp
+
+extern "C" {
+
+unsigned long long get_processor_ticks_p() {
+
+ unsigned long long result = 0;
+
+ __asm__ __volatile__ (
+ "rdtsc \n\t"
+ : "=A" (result)
+ );
+
+ return result;
+}
+
+}
+
+after creating static and shared libs with libtool everything is installed
+in /usr/local/lib as:
+libglue.so.0.0.0
+libglue.so.0 (symlink to 0.0.0)
+libglue.so (symlink to so.0.0.0)
+
+ldconfig is run and library is properly registered for loading
+( /etc/ld.so.conf contains /usr/local/lib and /etc/ld.so.cache contains
+required entry) and than can be called from the following code:
+
+test.cpp
+
+#include <iostream>
+#include glue.h
+
+using namespace std;
+
+int main() {
+
+ cout<<"Test processor ticks: ";
+ cout<<get_processor_ticks_p()<<endl;
+ return 0;
+}
+
+compiled with -lglue linking directive (code is linked to shared library).
+
+The following C# call fails
+
+[DllImport("glue", CallingConvention=CallingConvention.Cdcel)]
+static extern ulong get_processor_ticks_p();
+
+static void Main(string[] args) {
+
+ Console.WriteLine("P/Invoke call: {0}",
+ get_processor_ticks_p());
+
+}
+
+while changing DllImport assembly attribute to "libglue.so" removes the
+error.
+
+The above code works fine using "glue" with both Mono-1.0/1.0.1 and .NET
+1.1 on WinXP.
+
+Actual Results:
+
+Exception is thrown while calling properly installed shared library
+with "cross platform" name. P/Invoke routine does not handle properly
+platform specific prefix "lib" and suffix ".so".
+
+
+Expected Results:
+
+Successfull call with P/Invoke with cross platform name "glue" instead
+of "libglue.so".
+
+How often does this happen?
+
+Everytime test is run