https://bugzilla.novell.com/show_bug.cgi?id=635203
https://bugzilla.novell.com/show_bug.cgi?id=635203#c0 Summary: DllImport-ing a function from libc.so yields a DllNotFoundException Classification: Mono Product: Mono: Runtime Version: 2.6.x Platform: x86 OS/Version: Linux Status: NEW Severity: Normal Priority: P5 - None Component: interop AssignedTo: [email protected] ReportedBy: [email protected] QAContact: [email protected] Found By: --- Blocker: --- User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.7) Gecko/20100723 Fedora/3.6.7-1.fc13 Firefox/3.6.7 If I run the code below, I get a DllNotFoundException. But if, instead of "libc.so", I use "libc.so.6", it works. In Fedora 13, which I'm using, libc.so is a link script. Something in the runtime apparently should understand its syntax but doesn't. The code: ---------------------------------------- using System; using System.Runtime.InteropServices; namespace LinuxCaller { class MainClass { [DllImport("libc.so")] private static extern int getpid(); public static void Main (string[] args) { Console.WriteLine ("Hello World from process {0}!", getpid()); } } } ---------------------------------------- The contents of /usr/lib/libc.so in an up-to-date x86 Fedora 13: ---------------------------------------- /* GNU ld script Use the shared library, but some functions are only in the static library, so try that secondarily. */ OUTPUT_FORMAT(elf32-i386) GROUP ( /lib/libc.so.6 /usr/lib/libc_nonshared.a AS_NEEDED ( /lib/ld-linux.so.2 ) ) ---------------------------------------- Mono is 2.6.4, MonoDevelop is 2.2.2. Reproducible: Always Steps to Reproduce: 1. Create a console project in MonoDevelop 2. Paste the code above 3. Build; run. Actual Results: Unhandled Exception: System.DllNotFoundException: /usr/lib/libc.so at (wrapper managed-to-native) LinuxCaller.MainClass:getpid () at LinuxCaller.MainClass.Main (System.String[] args) [0x00000] in <filename unknown>:0 Expected Results: Hello World from process 6123! -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA contact for the bug. You are the assignee for the bug. _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
