[Mono-dev] Embedding C

Jonathan Pryor jonpryor at vt.edu
Tue Mar 21 20:41:41 EST 2006


On Tue, 2006-03-21 at 14:01 -0800, Rusmin Susanto wrote:

> I followed the instruction above. But I always get this error:
>  
> ./teste: error while loading shared libraries: libmono.so.0: cannot
> open shared object file: No such file or directory

Where is your libmono.so.0 located?  If it's not in /usr/lib, you may
need to set LD_LIBRARY_PATH to include the directory it's in.

By default, LD_LIBRARY_PATH is empty, and ld.so won't search the current
directory to resolve library dependencies, so copying libmono.so.0 to
the current directory (or elsewhere) won't work.
 
> 2. Is there any standard library in mono that is implemented in C and
> executed via internal calls?  Basically, I want to know real examples
> (in the real Mono runtime implementation) that are executed in similar
> way to the examples in the embed folder.

In a superficial manner, most of the methods in System.Math are internal
calls.  I say superficial, as these internal calls *look* like they are
implemented in mono/mono/metadata/sysmath.c (e.g.
ves_icall_System_Math_Sin), but in reality a more optimized version is
inserted during JIT compilation, in
mono/mini/mini-x86.c:mono_arch_get_inst_for_method.

Less confusing examples would be System.String (internal calls
implemented in mono/mono/metadata/string-icalls.c) and
System.Runtime.InteropServices.Marshal (mono/mono/metadata/marshal.c).

The "mapping" between the C# method name and the C functions are defined
in mono/mono/metadata/icall.c.

 - Jon






More information about the Mono-devel-list mailing list