Can dmd compile with my own runtime library?

Huang F Guan gdxxhg at gmail.com
Tue Aug 21 10:09:22 PDT 2007


Hi, I'm an operating system developer. I've written a win32-compatible and POSIX operating system, just for fun, but it can run many windows api programs. My system is written in C, it is not readable and diffcult to manage. Now I am looking for the new techniques to rewrite this os.

I've ever thought for an own compiler and linker, it is so complicated to develop an advanced one. But DMD did it, the D language almost satisfied what I need. Yes, you see, I am trying to use it to develop an operating system in D language, and maybe it will be the first one written in D language. 

While I was using C++ developing an os, the compiler can output the platform-independent code. But DMD compiler can not do this, because it needs a runtime library based on the present platform. 

I have tried gdc, but I failed too. It prints the error below when I link:

ld: warning: cannot find entry symbol _mainCRTStartup; defaulting to 00401000
hello.o(.text+0x18):hello.d: undefined reference to `_Dmodule_ref'
hello.o(.text+0x23):hello.d: undefined reference to `_Dmodule_ref'
hello.o(.data+0x0):hello.d: undefined reference to `_D10ModuleInfo6__vtblZ'
hello.o(.data+0x30):hello.d: undefined reference to `_D6object12__ModuleInfoZ'

Now I am wondering how can I link a platform-independent executable file? 
Do I need to rewrite the runtime library? 
Or just I need to write a tiny runtime library like gc, moduleinit, object?

I hope you can help me solve these puzzles, thanks!




More information about the Digitalmars-d mailing list