[yocto] dllmap config for a Mono app

Craig McQueen craig.mcqueen at innerrange.com
Thu Jun 8 19:35:47 PDT 2017


Joshua Watt wrote:
> On Thu, 2017-06-08 at 16:41 +1000, Craig McQueen wrote:
> > I have a Mono app that uses DllImport to load some functions from
> > libraries. The app can't find the libraries unless I create a Mono
> > config file containing dllmap lines to map the library's plain "DLL"
> > name (e.g. "foo") to the real name of the .so file (e.g.
> > "libfoo.so.4").
> 
> I'm not familiar with Mono, is libfoo a plain old library that anyone can use, or
> it is some special "Mono Library"

It's a plain old library. It just so happens that I wrote it, but other than that it's a typical library.

> > * What would be a good way in the .bb recipe to automatically create
> > the required Mono config file? It would need to find the "real" names
> > of the library files from the library(s) build output. So it would
> > DEPENDS on the library(s).
> >
> > * Is it better to create a local config file, or write it into
> > /etc/mono/config? (My Mono app has the DllImports in a compiled DLL,
> > and so far I've found that I need to create a local MyDll.dll.config
> > file; making a MyApp.exe.config file doesn't work.)
> 
> Packaging rules require that every file belong to one and only one package. If
> your application writes /etc/mono/config, you wouldn't be able to write that
> file from any other package, including some other Mono application. The
> MyApp.exe.config file (unfortunately) sounds like the ideal solution, because
> you know that no other package is going to try and write that file. Writing
> MyDll.dll.config runs into the same problem as /etc/mono/config (at least if
> you are trying to write it from your MyApp recipe), as another app might
> want to write the same file because it uses the same library but that isn't
> allowed by the packaging rules. If you want to write MyDll.dll.config, it should
> be done in the recipe that actually creates the dll.

/etc/mono/config is the "standard" system file for Mono, and an initial file is created by the mono recipe, so Mono can load various standard system libraries such as libc.so.6. Modifying it would be comparable to modifying other system config files such as /etc/modules, where it would be better to add a file to /etc/modprobe.d/. But unfortunately Mono doesn't provide for loading config from files in a directory like /etc/mono/config.d/

I guess I need to write to MyDll.dll.config in the recipe for my Mono app then.

Thanks for the advice on this, much appreciated.

-- 
Craig McQueen



More information about the yocto mailing list