[IronPython] ctypes on Mono

Dino Viehland dinov at microsoft.com
Mon May 31 00:24:14 CEST 2010


On OS/X I believe you need to use Mono's DllMap feature (http://www.mono-project.com/Config_DllMap) to map from the Linux library name (libdl.so) to the Mac OS/X library which exports dlopen.  I actually have no clue what exports it and I don't see one listed over here: http://gemma.apple.com/mac/library/documentation/Darwin/Reference/ManPages/man3/dlopen.3.html so hopefully someone else on the list knows.

It looks like on Linux the -X:ExceptionDetail command line option is being passed which is preventing the stack trace from having any line number information - or maybe the stack trace is cut off?  Either way it'd be useful to see the line number which is calling dlopen to understand what library we are failing to load.  My guess would be that it's trying to load the Python library but I'd think that would work fine (it looks like we pass in a null path in that case which should be alright for dlopen).


From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Tristan Zajonc
Sent: Saturday, May 29, 2010 3:59 PM
To: Discussion of IronPython
Subject: [IronPython] ctypes on Mono

I'm running the the latest IronPython 2.6.1 (.NET 2.0 version) with Mono.  I cannot import ctypes.

Is this behavior expected?  Any solutions?  Here are the exact results:

On OSX:
IronPython 2.6.1 (2.6.10920.0) on .NET 2.0.50727.1433
Type "help", "copyright", "credits" or "license" for more information.
>>> import ctypes
Traceback (most recent call last):
SystemError: libdl.so

On Ubuntu (using trunk Mono):

IronPython 2.6.1 (2.6.10920.0) on .NET 2.0.50727.1433
Type "help", "copyright", "credits" or "license" for more information.
>>> import ctypes
Traceback (most recent call last):
OSError: IronPython.Runtime.Exceptions.OSException: cannot load library
  at IronPython.Modules.CTypes.LoadLibrary (System.String library, Int32 mode) [0x00000] in <filename unknown>:0
  at IronPython.Modules.CTypes.dlopen (System.String library, Int32 mode) [0x00000] in <filename unknown>:0
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod*,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0


Best,
Tristan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20100530/1c0ff14c/attachment.html>


More information about the Ironpython-users mailing list