[Mono-devel-list] malloc and free on CLI
kornelpal at hotmail.com
Sat Jul 16 16:40:01 EDT 2005
>From: Jeyasankar Kottalam
>> As far as I know malloc and free are C runtime library functions not
>> intrinsic functions. I think they should not be implemented at compiler
>> level. These functions are allocating memory from a heap.
>Correct, but I am also writing a partial libc for a couple of reasons:
>to be able to test "real world" applications, and it is also part of the
>acceptance criteria that I demonstrate a "real world" C application
>Regardless of whether I write the final implementation, this is an issue
>needs to be considered.
I think the libc should be written in C and compiled into a fully managed
assembly that could be part of Mono Class Library and could be installed to
the GAC. You were talking about C# in your previous message. I think it's
much easier and pretty to write it in C. Of course this will need a C
compiler but I think it's worth to wait until the compiler will be at least
partially complete. And it's much easier to port an existing libc to managed
C than to C#.
The compiler and C runtime library are two different things and I think you
shouldn't be forced to forge a libc just to can compile an application that
uses libc. I think in the early stage the Mono Class Library should be used
instead of a libc. And of course implementing a libc is just as much work as
implementing a C compiler.
I don't like Microsoft C++ compiler regarding managed code because it
allways want to use the C runtime library and /crl:pure imports C runtime
functions using P/Invoke. This makes the resulting assembly platform
dependent altough the IL code itself in assembly is platform independent.
So I think your implementation should not require libc and should link libc
as a managed assembly using metadata references to be platform independent.
More information about the Mono-devel-list