Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mono ignores dllmaps in the app.config file

Tags:

linux

mono

It seem Mono ignores dllmaps in the local configuration file.

I want to port my .NET application on Linux (ubuntu) which calls native libraries so I have dllmaps to make my code work. The mono docs says you have to make a something.exe.config for something.exe and put application specific configs in it. it parses the file (because it complains if I make some spelling mistakes in it) and the filename is correct but it seems it ignores the dllmaps.

The config file is simple:

<configuration>
<dllmap dll="i:openal32.dll" target="libopenal.so" />
</configuration>

Mono does not find the openal32.dll and throws DllNotFoundException. But if I copy that dllmap entry in the main /etc/mono/config file then everything is fine. If do a $MONO_LOG_LEVEL=debug mono... trick to see what it does and I see there is no attempt to load libopenal.so at all. But many tries to load libopenal32.dll, ./libopenal32.dll libopenal32.so, openal32.so, etc. files.

Probably I ran into a Mono bug again?

I want to pack this config file in the archive and I don't want to ask my users to mess with the /etc/mono/config file.

Any ideas?

like image 925
Calmarius Avatar asked Jan 19 '10 20:01

Calmarius


1 Answers

Are all of your DllImport attributes in the code using "openal32.dll" or are some using "openal32" instead? In any case the config file refers to the assembly that contains the P/Invoke methods: the most likely issue is that you created the config for the main assembly while the P/Invoke methods are in a separate library assembly. Just rename the file to OpenAlUsingAssembly.dll.config.

like image 126
lupus Avatar answered Sep 29 '22 21:09

lupus