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

jims stapleton.41 at osu.edu
Sat Mar 19 11:55:05 EDT 2011

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

verification it exists:
[sjss at elrond ~/Desktop/Agar.NET_Demo]$ ls -l /usr/local/lib | grep -e
lrwxr-xr-x   1 root  wheel        17 Mar 18 15:39 libag_core.so ->
-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 ->
-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 ->
-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 ->
-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 ->
-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 ->
-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+"]" +

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?
-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.

More information about the Mono-list mailing list