[Mono-list] SWIG/P/Invoke not working in 2.2,2.4
fevans
fevans at harris.com
Tue Sep 22 20:06:26 EDT 2009
Just wanted to follow up and close this thread. Everything is working now. I
had initially reported the problem with SWIG in Mono2.x or higher. In fact
my mono1.9 build was 32-bit, because I used the mono-installer. Because the
installer wasn't available for 2.0 I had to compile from source, which
resulted in a 64-bit build. As soon as I compiled my C++ project and swig
bindings in 64-bit, everything ran fine.
fevans wrote:
>
> I've got a pretty big SWIG investment. When I use the Mono1.9.1 installer,
> my SWIG classes work in both Windows and Fedora. The debian installer is
> no longer maintained, so upgrading to a newer version of mono immediately
> introduces a thousand new questions. How did I compile it? What
> config-settings, etc.
>
> The error message is the usual one:
> ====================================
> Mono-INFO: DllImport attempting to load: 'libhutil_csharp'.
> Mono-INFO: DllImport loading location: 'libhutil_csharp.so'.
> Mono-INFO: DllImport error loading library: 'libhutil_csharp.so: cannot
> open shared object file: No such file or directory'.
> Mono-INFO: DllImport loading library: './libhutil_csharp.so'.
> Mono-INFO: DllImport error loading library './libhutil_csharp.so: cannot
> open shared object file: No such file or directory'.
> Mono-INFO: DllImport loading: 'libhutil_csharp'.
> Mono-INFO: DllImport error loading library 'libhutil_csharp: cannot open
> shared object file: No such file or directory'.
>
> (<unknown>:10993): Mono-WARNING **: DllImport unable to load library
> 'libhutil_csharp: cannot open shared object file: No such file or
> directory'.
> ====================================
>
> 1. The library is in my LD_LIBRARY_PATH.
> 2. I've run ldd to verify that its dependencies are accounted for.
> I've generated a lot of logs on this with MONO_LOG_LEVEL and LF_DEBUG.
> Trouble is, there's nothing helpful.
>
> QUESTION:
> ====================
> 1. Is there any known behavior change in p/Invoke, between mono 1.9.1 and
> mono 2.0+?
>
> 2. If p/Invoke is failing due to a higher order dependency, do any tools
> exist for reporting this? ldd and objdump don't help.
>
> The basic "Hello World" example from the following URL didn't help.
> http://mono-project.com/Interop_with_Native_Libraries
>
> [DllImport ("libc.so")]
>
> I had to change it to the following
>
> [DllImport("libc.so.6")]
> private static extern int getpid();
>
> So, the good news is I was able to get this basic example working. But
> beyond this basic example, I have no idea why the dll-loader is flatly
> ignoring (not even probing my dll).
>
>
>
--
View this message in context: http://www.nabble.com/SWIG-P-Invoke-not-working-in-2.2%2C2.4-tp23246504p25530940.html
Sent from the Mono - General mailing list archive at Nabble.com.
More information about the Mono-list
mailing list