[Mono-list] RE: Mono-list digest, Vol 1 #6 - 20 msgs

Michael Lambert michaellambert@bellsouth.net
Tue, 10 Jul 2001 19:01:09 -0400


> -----Original Message-----
> From: Stefan Arentz [mailto:stefan.arentz@soze.com]
> > > From: Bob Smith <bob@thestuff.net>
> > > Subject: [Mono-list] binding
> > >
> > > I'm looking at implementing the Math class and I was wondering would
it
> > > be better to implement it from scratch in C#, or bind it to standard C
> > > math functions. Each way is just as portable as the other, both I
think
> > > will be just about the same performance, the C binding requires less
> > > work, and the C# way would probably be cleaner. What is the general
> > > consensus about binding vs codeing when it comes to making use of
> > > standard C libs?
> > >
> > Bind it to standard C (My vote).
>
> That defeats one of the great features of an interpreted (jit-compiled)
> system; portability.
>

Obviously, functions like System.Math.Min can be done in IL. Unfortunately,
not everything will be.  Take this example from .Net from System.Math

.method public hidebysig static float64  Cos(float64 d) cil managed
internalcall
{
} // end of method Math::Cos

Now load up MSVCR70.DLL in the Dependency Walker and look at ordinal 61
(0x03D): _CIcos

My vote was for the standard C libraries in this case.  Feel free to post
your alternative.

Michael