[Mono-list] Difficulty with DllImport in mono - config.AG_Config file is not in load-path.

Danny dgortonii at gmail.com
Sat Mar 19 12:32:40 EDT 2011


Without seeing your wrapper code, I'd guess that your DllImport 
statements include the file extension (.dll).  To make the lookup work 
properly on Linux/Mono you either need to exclude the file extension 
(ie: just use 'ag_gui' - both .NET and Mono will resolve this correctly 
if the file is in a proper search path) so the native naming schemes can 
be used on the respective platforms, or use a DllMap in your config file 
to tell mono how to map ag_gui.dll (and others).

On 03/19/2011 11:55 AM, jims wrote:
> Background, I am working on a C# wrapper for Agar ( http://libagar.org/ ) in
> Visual Studio express 2010. I have knocked the .NET framework target down to
> 2.0 to improve platform compatibility, for users of older software.
>
> When I try to run the first demo, I get this error:
> [sjss at elrond ~/Desktop/Agar.NET_Demo]$ mono ./AgarDemo_Windows.exe
> [DllNotFoundException:ag_gui.dll]The //config.AG_Config file is not in
> load-path.
>
> verification it exists:
> [sjss at elrond ~/Desktop/Agar.NET_Demo]$ ls -l /usr/local/lib | grep -e
> 'libag_.*.so'
> lrwxr-xr-x   1 root  wheel        17 Mar 18 15:39 libag_core.so ->
> libag_core.so.1.4
> -rw-r--r--   1 root  wheel    299513 Mar 18 14:54 libag_core.so.1.4
> lrwxr-xr-x   1 root  wheel        16 Mar 18 15:39 libag_dev.so ->
> libag_dev.so.1.4
> -rw-r--r--   1 root  wheel     70586 Mar 18 14:54 libag_dev.so.1.4
> lrwxr-xr-x   1 root  wheel        16 Mar 18 15:39 libag_gui.so ->
> libag_gui.so.1.4
> -rw-r--r--   1 root  wheel   1246374 Mar 18 14:54 libag_gui.so.1.4
> lrwxr-xr-x   1 root  wheel        17 Mar 18 15:39 libag_math.so ->
> libag_math.so.1.4
> -rw-r--r--   1 root  wheel    328560 Mar 18 14:54 libag_math.so.1.4
> lrwxr-xr-x   1 root  wheel        15 Mar 18 15:39 libag_rg.so ->
> libag_rg.so.1.4
> -rw-r--r--   1 root  wheel    255964 Mar 18 14:54 libag_rg.so.1.4
> lrwxr-xr-x   1 root  wheel        15 Mar 18 15:39 libag_vg.so ->
> libag_vg.so.1.4
> -rw-r--r--   1 root  wheel    205641 Mar 18 14:54 libag_vg.so.1.4
>
>
> I have installed Agar, FreeType and SDL on my machine, all the libs are in
> /usr/local/lib, are in my libpath, and the directory has been ldconfig'ed
> for good measure after the first time I saw the error.
>
> Since Visual Studio 2010 wants to add the '.dll' to the first argument of
> the DllImport call, I have added the following to the  section of the config
> config of all of my .NET dlls/exes:
>
>
>
>
> ag_core.so is loading properly, the error message is produced by:
>    System.Console.WriteLine("["+e.GetType().Name+":"+e.Message+"]" +
> Agar.GetError()+"\n");
>
> The Agar.GetError() part is what I find interesting - that requires that
> ag_core be called. I *believe* the "//config.AG_Config file is not in
> load-path." portion of the error is being set by an earlier portion of the
> code in a manner that doesn't cause an exception or problem, as a warning.
> Regardless, it shouldn't make "ag_gui" unlocatable.
>
>
> Any ideas what I should look into next?
> Thanks,
> -Jim Stapleton
>
> --
> View this message in context: http://mono.1490590.n4.nabble.com/Difficulty-with-DllImport-in-mono-config-AG-Config-file-is-not-in-load-path-tp3389891p3389891.html
> Sent from the Mono - General mailing list archive at Nabble.com.
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
>


More information about the Mono-list mailing list