Can dmd compile with my own runtime library?

Chad J gamerChad at _spamIsBad_gmail.com
Tue Aug 21 14:56:18 PDT 2007


Huang F Guan wrote:
> 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!
> 

I'm sorry OS dev isn't really my thing, but I can maybe point you to 
some stuff.
There used to be a fairly well organized kernel written in D called 
Titan, but their site is down so that project is probably past its time.

But Titan wasn't the only D OS kernel project, here are some others:
http://www.geocities.com/one_mad_alien/dkernel.html
http://www.dsource.org/projects/osian
http://trac.brainsware.org/ocd/
(This is also not an exhaustive search by any means.)

Hopefully other D users will be able to give more specific pointers on 
the topic, but until then I suggest just looking at what others have 
done to bootstrap a D OS into reality (it's been done).



More information about the Digitalmars-d mailing list