Can dmd compile with my own runtime library?
Alexander Panek
alexander.panek at brainsware.org
Thu Aug 23 05:11:46 PDT 2007
Huang F Guan wrote:
> Hi, What you said is the basic things, I have all done now. I had a look at the OCD kernel code, there's no class using in it, but intead of struct.
Using structs is intentional; structs don't require heap allocation,
thus the kernel's stack is used for those. Given how flexible structs
are in D, you can use them just like classes, which is a very handy
advantage.
Of course, as soon as dynamic heap allocation is available, classes can
be used like always. But this requires a basic memory management, which
is not yet built into OCD.
> I think a class is important for wrapping the functions, and template is useful too.
You can use templated structs and/or functions without a problem. I've
tried to use it for several memory operational functions (memcpy,
memmov), but I didn't look into it too deep, which is why I just went
for pointers nevertheless.
>
> I wrote an object.d, see below:
>
> ...
You can use Tango's object.d[i] almost directly and provide the
necessary functions in your code, like malloc and friends.
> I used DMD to compile it, a fatal error occured and the DMD-self exited.
What operating system are you using? I don't think it's possible to
compile ELF binaries on Windows with DMD. (Given the fact that you use
ELF, which I assume.) I suggest using GDC + binutils (ld). I don't know
if you're experienced with LD scripts - if not, there's a .ld file in
the repository which *should* work. It is yet to be changed to include
all D specific sections et al.
Kind regards,
Alex
More information about the Digitalmars-d
mailing list