[Mono-dev] AppSettings, embedding C

Paolo Molaro lupus at ximian.com
Thu Mar 23 10:28:18 EST 2006


On 03/23/06 vavra at software602.cz wrote:
>  I would like to get the same functionality like when I create pure C#
> executable eg. hello.exe. I create hello.exe.config and while starting
> hello.exe
> $ mono hello.exe
> 
> mono parses the hello.exe.cofig and itself fill out AppSettings fields.

No, it doesn't. The class libs do that, so you can call the method in
the class libs that do.

> So I would like to say libmono that it should load config like mono
> runtime also does. Mono runtime must have such function, so it shouldn't
> be a problem to publish for embedding API.

The mono runtime and libmono are the same thing.

On 03/23/06 vavra at software602.cz wrote:
> a)C executable calls c# dll:
> method = mono_class_get_method_from_name("getAppBase()", ..)
> mono_runtime_invoke(method,...);
> 
> b) In C# DLL I access AppDomain.CurrentDomain.SetupInformation.ApplicationBase:
> public static string getAppBase() {
>     return ...ApolicationBase;
> }
> 
> Problem: returned value is NULL.
> 
> When I call from C a C# EXE using mono_jit_exec(...)
> it probably initializates C# assembly and ..ApplicationBase is correct.
> 
> Is there any function in embedding api, which would initilizates an dll assembly?

There is no API to do that, you must use mono_jit_exec () or
mono_runtime_run_main (), the latter allows you to exec any suitable
method in your assembly (not necessarily the entry point).

lupus

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



More information about the Mono-devel-list mailing list