modifying the DMD compiler

torhu no at spam.invalid
Sat Dec 13 10:25:04 PST 2008


On 13.12.2008 17:16, Moritz wrote:
> Hello,
>
> Im a student of computer science and at university, we're working on a
> distributed shared memory system, implemented as a C library.
>
> Im also a great fan of D, and so Im asking myself if I could connect D
> to the C library (which is no problem, as far as I know) and then modify
> the memory allocation of the compiler to place objects into the
> distributed memory (I would also need to disable garbage collection, but
> that should be no problem).
>
> Ive already reviewed the sourcecode of the dmd (the parts of it that are
> shipped with the dmd) and found out malloc() is called in Mem.c
>
> So I guess a rather simple way to do what I need would be to overwrite
> the new() operator or to add another operator to allocate distributed
> memory (something like new_shared() maybe).
>

D supports 'placement new' like in C++:
http://www.digitalmars.com/d/1.0/class.html#allocators

If you're using Tango or dmd 2.x you can also replace the GC with your 
own version if you need to.



More information about the Digitalmars-d mailing list