[Mono-list] GLib Critical Error at attemting to embed Mono (and other minor troubles).

Lucyberad Lucyberad at gmail.com
Sun Aug 23 18:21:21 EDT 2009


Hi,


Robert Jordan wrote:
> 
> Lucyberad wrote:
>> I got an assertion error on mono_jit_exec. The console output an error
>> from
>> Glib:
>> http://www.nabble.com/file/p25093790/visual_mono_glib_asssertion_error.png 
>> (right-click: show image to view it fullsize)
> 
> Are you calling mono_set_dirs ()? If yes, post the code.
> 
>> More than this errors, I had many troubles at embeding Mono.
>> The first is about linking to a library:
>> mono_domain_assembly_open(domain,
>> file) don't work if the mscorlib.dll library file is not located to
>> "../lib/mono/1.0/mscorlib.dll" (relative to the main exe). I made a copy
>> of
>> this dll to the path but I don't know how to put it on the same folder
>> than
>> the exe (or use this dll as static). In fact, I don't really know what to
>> do
>> with this dll. If my memory is good, it's the main dll of .NET langage.
> 
> The assembly must be placed in $libdir/mono/x.x/, where $libdir
> is the directory you've passed to mono_set_dirs ().
> 

No, I don't call mono_set_dirs(). The result console in screenshot is the
code you see in VC behind (with mono_set_dirs commented).
I've un-comment mono_set_dirs to this:
mono_set_dirs("C:\\Program Files (x86)\\Mono-2.4.2.3\\lib\\", "C:\\Program
Files (x86)\\Mono-2.4.2.3\\etc\\");
and it don't works better than before (always glib error) but this time I
don't need to care about mscorlib.dll. If I understand well, it tells where
to find mscorlib.dll. So, to release the app I need to move each asked dll
to a subfolder (and keep directory hierarchy) with mono_set_dirs("./lib",
"./etc") where '.' is in fact the current folder (working directory)?



Robert Jordan wrote:
> 
>> The second is about understanding why compiler can't recognize
>> mono_config_parse() but I finally found it in mono-config.h (which is not
>> shown 
>> http://anonsvn.mono-project.com/viewvc/trunk/mono/samples/embed/teste.c?&view=markup
>> in sample ). 
> 
> So this is solved.
> 

It is, but I mention it to say that the sample is not up-to-date and
compilable.



Robert Jordan wrote:
> 
>> The third is why is mscorlib.dll in "mono/1.0/". Does it means I try to
>> embed Mono1.0 instead of 2.0 (or 2.4)?
> 
> Yes. This is because you've compiled the assembly with mcs. If you
> want .NET 2.0, you must use gmcs.
> 

Ok, I didn't know. (for people looking for more information, I found this
wiki thread talking about it:  http://www.mono-project.com/CSharp_Compiler
http://www.mono-project.com/CSharp_Compiler ).
I've compiled with gmcs (because I plan to use C# 3.0 or 3.5 implementation)
and GLib error is still here.


Robert Jordan wrote:
> 
>> The last is why the path of my file must be absolute and not relative? If
>> I
>> do relative, the assembly var is = 0. Can't I just call with
>> "helloworld.exe" (or "./helloworld.exe")?
> 
> I don't understand this sentence. You seem to be speaking about
> some source code you didn't share with us.
> 
> Robert
> 

Sorry, i'm not an english native-speaker.
So, I mean why Mono don't handle relative path? As you see on the screenshot
(http://www.nabble.com/file/p25093790/visual_mono_glib_asssertion_error.png),
I give the path of my file in absolute way:
const char* file = "C:\\Users\\Lucyberad\\Documents\\Visual Studio
2008\\OtherProject\\SandboxMono\\Builds\\Debug\\helloworld.exe";
I want to do:
const char* file = "helloworld.exe"; or const char* file =
"./helloworld.exe";
This allow me to make the program runnable on an other computer than mine.
I'll make a "trick" which transform a relative path into an absolute path
but I'm suprised that there is no relative path allowed as input in Mono
Path (mono_set_dirs() or mono_domain_assembly_open()).
I'm not sure if it's more about C++ than Mono.
Probably it will no longer be a problem for me because I plan to use AOT and
use Bundles (I don't know yet exactly how it works, but I actually focus on
making a simple helloworld working on embed app).

-----------------------

More info on GLib error (maybe it will help): The only link I made is to
mono.lib, created from mono.dll with mono.def file. I've made a copy of
mono.dll, libgthread-2.0-0.dll & libglib-2.0-0.dll into the working
directory.

I attached to this thread the  http://www.nabble.com/file/p25108056/main.cpp
main.cpp  file.

Thanks for help,
Lucyberad.
-- 
View this message in context: http://www.nabble.com/GLib-Critical-Error-at-attemting-to-embed-Mono-%28and-other-minor-troubles%29.-tp25093790p25108056.html
Sent from the Mono - General mailing list archive at Nabble.com.



More information about the Mono-list mailing list