[Mono-list] How best to detect if running in mono from an unmanaged library?

Paolo Molaro lupus at ximian.com
Mon May 5 05:45:28 EDT 2008


On 04/30/08 Maser, Dan wrote:
>   I've got a situation where my managed app p/invokes to my unmanaged
> library.  The unmanaged library also gets used in regular unmanaged
> processes.
> 
>   The library has some logic that uses the name of the executable.
> Which doesn't what I want when it's used via the interop.  For example
> when the library is used from "my_regular_program.exe" it generates an
> output file of "my_regular_program.output".  When I interop to that same
> library and run under mono using the command line "mono my_assembly.exe"
> the library generates "mono.output" when naturally I'd prefer
> "my_assembly.output".

Since you control both ends, make things explicit by having a function
in the unmanaged lib that is used to set the basename and p/invoke that
from the managed program.

lupus

-- 
-----------------------------------------------------------------
lupus at debian.org                                     debian/rules
lupus at ximian.com                             Monkeys do it better


More information about the Mono-list mailing list