Yawen Chan
10/16/2002 7:34:00 AM
Thanks a lot Thong, you give a nice overview of what can be done. I'll
write some simple apps and see which way suits my need. I'll also try to
write the algorithm in C# and see the difference in performance. Thanks
again. This really helps.
Yawen
"Thong Nguyen" <tum(NOSPAM)@veridicus.com> wrote in message
news:uiyR3tNdCHA.2392@tkmsftngp08...
> Hi there,
>
> Primitive types like bool and char aren't manipulated as objects by the
CLR.
> The Jitter will optimize them nicely :).
>
> There are some options for including C code inside C#.
>
> + Put the C code inside a DLL. Access the exported functions through
> P/Invoke.
> + Put the C code inside a COM object. Access through COM interop. [This
> approach won't be cross platform]
> + Use Managed C++ to write your code (conversion from C -> C++ is
trivial).
> [This approach also won't be cross platform]
>
> I'd recomend using a DLL since it is the cleanest and most cross platform.
> COM and MC++ don't have reliable non-windows implementations.
> You might find the MC++ is faster than the DLL approach since it elimiates
> some of the P/Invoke overhead. Profiling might help determine if it is
> worth the it.
>
> ^Tum
>
> "Yawen Chan" <y3chan@engmail.uwaterloo.ca> wrote in message
> news:OjiITWLdCHA.1652@tkmsftngp09...
> > Hi,
> >
> > I'm writing a C# project and want to use C codes for some algorithms and
> > calculations to enhance performance. I'm sure there are a lot of
examples
> > on the web, can someone point me to those sites (I did quite some
research
> > but couldn't find anything useful)?
> >
> > I think I can use a DLL written in C in a C# project. Is there any
other
> > ways to include C in C# other than using the DLL approach?
> >
> > Thanks very much.
> >
> > Yawen
> >
> >
>
>