[Mono-list] dlopen problem on Mono 2.4.4

batuakan batuakan at sabanciuniv.edu
Thu Jan 27 01:43:15 EST 2011


I have been trying to write a simple c# program to dynamically load a shared
object file under mono 2.4.4, in linux environment. My call to dlload
function ends up a SIGSEGV and the application exits I tried with several
shared objects, the system seems to be able find them, but still unable to
load. What might be the problem?


c# source code

using System;
using System.ComponentModel;
using System.Runtime.InteropServices;

namespace swi
	class MainClass

		[DllImport("libdl.so", CallingConvention = CallingConvention.Cdecl,
CharSet = CharSet.Auto)]
		private static extern IntPtr dlopen([In] string filename, [In] int flags);

		public static void Main (string[] args)
			IntPtr handle = dlopen("libc.so.6", 0x02);
			if (handle == null)
				Console.WriteLine("Unable to load shared object");
				Console.WriteLine("Shared object successfully loaded");

Application Output

Module loaded: swi, Version=1.0.4044.28138, Culture=neutral,

  at (wrapper managed-to-native) swi.MainClass.dlopen (string,int) <0x00004>
  at (wrapper managed-to-native) swi.MainClass.dlopen (string,int)
  at swi.MainClass.Main (string[]) [0x00000] in
  at (wrapper runtime-invoke) swi.MainClass.runtime_invoke_void_object
(object,intptr,intptr,intptr) <0xffffffff>

Native stacktrace:

	/usr/bin/mono() [0x80ca6e4]
	/usr/bin/mono() [0x80f6893]
	/lib/ld-linux.so.2(+0x11688) [0xb77df688]
	/usr/lib/libdl.so(+0xc0b) [0xb6ff0c0b]
	/lib/ld-linux.so.2(+0xd7e6) [0xb77db7e6]
	/usr/lib/libdl.so(+0x109c) [0xb6ff109c]
	/usr/lib/libdl.so(dlopen+0x41) [0xb6ff0b41]
	/usr/bin/mono(mono_runtime_exec_main+0xde) [0x8113b1e]
	/usr/bin/mono(mono_runtime_run_main+0x15a) [0x811429a]
	/usr/bin/mono(mono_debugger_main+0x77) [0x80f9e67]
	/usr/bin/mono(mono_main+0x150c) [0x80b316c]
	/usr/bin/mono() [0x805ad25]
	/lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe6) [0xb7551bd6]
	/usr/bin/mono() [0x805ac61]

Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.

Thread 2 exited.
Thread 3 exited.
Thread 1 exited.
Process 1 exited.
Target exited.

View this message in context: http://mono.1490590.n4.nabble.com/dlopen-problem-on-Mono-2-4-4-tp3241535p3241535.html
Sent from the Mono - General mailing list archive at Nabble.com.

More information about the Mono-list mailing list