OSDev.org

The Place to Start for Operating System Developers
It is currently Fri Mar 29, 2024 2:36 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 77 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6  Next
Author Message
 Post subject: Re: OS in D language
PostPosted: Mon Jan 26, 2009 7:02 pm 
Offline
Member
Member
User avatar

Joined: Mon Jun 05, 2006 11:00 pm
Posts: 2293
Location: USA (and Australia)
I would be EXTREMELY grateful if someone could share their experiences with the D language (wiki?). I have thought about converting to D many times cause I love the language, but now I heard that is designed for systems programming :shock:

_________________
My OS is Perception.


Top
 Profile  
 
 Post subject: Re: OS in D language
PostPosted: Tue Jan 27, 2009 8:15 am 
Offline
Member
Member
User avatar

Joined: Fri May 16, 2008 7:13 pm
Posts: 301
Location: Hanoi, Vietnam
Currently I'm working on D cross-compiler and stuffs like linker script and so. Then a D wiki page will appear ! :)

_________________
"Programmers are tools for converting caffeine into code."


Top
 Profile  
 
 Post subject: Re: OS in D language
PostPosted: Tue Jan 27, 2009 1:58 pm 
Offline
Member
Member

Joined: Wed Oct 31, 2007 9:09 am
Posts: 1385
quanganht wrote:
Currently I'm working on D cross-compiler and stuffs like linker script and so. Then a D wiki page will appear ! :)


Cool, I'll be eagerly awaiting.


JAL


Top
 Profile  
 
 Post subject: Re: OS in D language
PostPosted: Tue Jan 27, 2009 8:42 pm 
Offline
Member
Member
User avatar

Joined: Mon Jun 05, 2006 11:00 pm
Posts: 2293
Location: USA (and Australia)
berkus wrote:
dmd vs. gdc - messy. different options, different search paths. gdc can't find some runtime libs, dmd seems to find standard libs fine, but chokes on importing local modules. May be it was my setup.


dmd - Is it the compiler/linker the D website provide for system programming or just applications? And I didn't find any info on the executable format the linker outputs (my OS uses ELF).
gdc - Wikipedia states it only supports D1.0. The compiler isn't 100% faithful to the specification (though they list the issues on their website).

D1.0 vs D2.0 - The 2.0 dmd compiler is unstable, though there are several features I like. The 2.0 specification is also likely to evolve a bit.

_________________
My OS is Perception.


Top
 Profile  
 
 Post subject: Re: OS in D language
PostPosted: Tue Jan 27, 2009 9:18 pm 
Offline
Member
Member
User avatar

Joined: Tue Apr 10, 2007 4:42 pm
Posts: 224
A long time ago, when I tried to port my kernel to D, I ran into those problems as well:

dmd is actively developed and is the official compiler, but is really not intended to be a compiler for the system. It's distributed in binary form (can't seem to find the source), and only for 32-bit Windows and Linux. It only compiles to the native executable of the platform... way to go, system programming!

gdc is an improvement because it's a front-end to gcc, making it more flexible (and support more target formats). However, it's a one-man show, it's been unmaintained for more than a year now, and that state doesn't seem to have changed (It only supports GCC 4.0.* as of this writing, without patches). Apparently, the reason they haven't added support for D in the GCC project (which would really be a blessing, IMHO) is because of licensing conflicts :roll:.

There's also llvmdc, which seems to be the best hope so far (D front-end on the LLVM compiler). It's really early in production, but if I figure out how to make it cross-compile x86-64 ELF binaries, then I might have a chance.

Finally, there's the runtime stubs. Oh, the runtime stubs... From my experience, it was too painful to implement (I gave up), and apparently differs between compiler and/or library versions. Not to mention that there are two competing libraries, two partially-incompatible standards, and three different compilers. Great...

But that was a long time ago. Now (for my kernel at least), I'm sticking with my C++ foo. 8)

_________________
"Sufficiently advanced stupidity is indistinguishable from malice."


Top
 Profile  
 
 Post subject: Re: OS in D language
PostPosted: Wed Jan 28, 2009 12:39 am 
Offline
Member
Member
User avatar

Joined: Tue Aug 26, 2008 10:02 pm
Posts: 44
Location: Land of the Dead
I agree with you Zenith, dmd is terrible. GDC, using the dmd implementation, is also...meh...bad on many levels. The source is around, GDC uses it. And yes, where did that guy go who is maintaining it?! This is why we are GTFO'ing to LLVM. (We see GCC as a sinking ship, also, but that's a different story)

LLVM's LDC is the way to go. We are working actively with LDC developers on porting XOmB (our D exokernel) to use it. Apparently we are a nice test case :) They tell us our kernel compiles fine for x86-64 (although LLVM's variadics for x86-64 are nonexistent as of the present). It doesn't produce a valid binary because it needs to be a naked compiler, and it isn't. But hopefully they will step us through that and we can update the wiki.

LDC is great because it marks the true second compiler implementation of the language (remember: gdc uses the dmd codebase). So LDC should be a viable development tool for OS work. (I've obviously not had a chance to really use it though)

quanganht wrote:
Currently I'm working on D cross-compiler and stuffs like linker script and so. Then a D wiki page will appear ! :)

Great! I see you are on our mailing list. Please use it for questions, we would like to help. Mixins are so nice for interrupt handling 8) I've personally built gdc cross-compilers several times targeting 32-bit and 64-bit machines. One of us has patches that are necessary.

MessiahAndrw wrote:
gdc - Wikipedia states it only supports D1.0.

Yep, pretty much. As Zenith points out, the SOLE maintainer is sorta missing ATM. Also, dmd would be a terrible choice for systems dev...unfortunately. Doesn't target 64 bit machines.. It doesn't like stripping out runtimes and the like. It is difficult, that is. This is much of the reason behind the two runtimes (Tango/Aries vs Phobos) being so incompatible. But, that's why LDC exists.

Zenith wrote:
I'm sticking with my C++ foo. 8)

Awwww... (confession: I like me some C++ sometimes :oops: )

Overall, I am very impressed at the response of this thread. I will try and contribute what I can to the wiki.


Top
 Profile  
 
 Post subject: Re: OS in D language
PostPosted: Wed Jan 28, 2009 3:25 am 
Offline
Member
Member
User avatar

Joined: Mon Jun 05, 2006 11:00 pm
Posts: 2293
Location: USA (and Australia)
I'm in the process of reading the D language specification (I thought reading how exactly how the language works would beat reading tutorials/samples and leaving a lot of assuming) and I'm just past halfway through. One thing I am unsure of is it says operators :: and -> do not exist.

Now if had a pointer to a struct, which had a member called foo, how would you access it.
myStruct.foo; // compiler detects myStruct is a pointer and all is good
or
(*myStruct).foo;

If the former is true, how you do know if:
myStruct = mySecondStruct;
is calling the copy constructor or making myStruct point to mySecondStruct?

I don't have a D compiler environment set up atm.

_________________
My OS is Perception.


Top
 Profile  
 
 Post subject: Re: OS in D language
PostPosted: Wed Jan 28, 2009 3:45 am 
Offline
Member
Member
User avatar

Joined: Fri May 16, 2008 7:13 pm
Posts: 301
Location: Hanoi, Vietnam
Hey guys. I'm using Cygwin. And what the hell is this:
Image

It turns out that G++ included GDC ???

_________________
"Programmers are tools for converting caffeine into code."


Top
 Profile  
 
 Post subject: Re: OS in D language
PostPosted: Wed Jan 28, 2009 3:58 am 
Offline
Member
Member
User avatar

Joined: Fri Mar 07, 2008 5:36 pm
Posts: 2111
Location: Bucharest, Romania
I'm not sure what you're talking about. You just showed us what version of G++ you're using with Cygwin...

_________________
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]


Top
 Profile  
 
 Post subject: Re: OS in D language
PostPosted: Wed Jan 28, 2009 4:47 am 
Offline
Member
Member
User avatar

Joined: Thu Nov 16, 2006 12:01 pm
Posts: 7612
Location: Germany
Perhaps he's surprised that he's got GDC included when he didn't ask for it. ;-)

GCC actually supports several languages beyond C/C++. (Java - or more exactly, GCJ - and Objective-C spring to mind.)

_________________
Every good solution is obvious once you've found it.


Top
 Profile  
 
 Post subject: Re: OS in D language
PostPosted: Wed Jan 28, 2009 5:31 am 
Offline
Member
Member
User avatar

Joined: Mon Jun 05, 2006 11:00 pm
Posts: 2293
Location: USA (and Australia)
I just finished reading the D1.0 language specification (took roughly 8 hours on and off) from back to front completely.

I'm now inspired to write something in D. Since there seems to be a lot of issues regarding system programming in D, I should write an application. I've decided I should port my game framework to D. The C libraries (Win32, CG, etc) I depend on can be easily interfaced with D.

The only thing disappointing is interop'ing with C++ libraries (which I need for DirectX and majority of physics libraries) which is excluded from D1.0, but not from D2.0. I haven't read exactly how so, but I'm going to update myself and read the 2.0 language spec (though after reading the differences between 1.0 and 2.0 so I'm not repeating myself).

EDIT: It seems like the hard work is done for me http://www.dsource.org/projects/nonagon/browser/trunk/nonagon/d3d9d.d :)

_________________
My OS is Perception.


Last edited by AndrewAPrice on Wed Jan 28, 2009 6:27 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: OS in D language
PostPosted: Wed Jan 28, 2009 5:38 am 
Offline
Member
Member

Joined: Wed Oct 31, 2007 9:09 am
Posts: 1385
Wilkie wrote:
Overall, I am very impressed at the response of this thread.


And I am very impressed with someone actually using D for OS deving. I considered it, but since I knew (and know) little D, and wasn't sure of the tools, I decided against it (using C++ now). Still very interested in it though!


JAL


Top
 Profile  
 
 Post subject: Re: OS in D language
PostPosted: Wed Jan 28, 2009 8:43 am 
Offline
Member
Member
User avatar

Joined: Tue Aug 26, 2008 10:02 pm
Posts: 44
Location: Land of the Dead
MessiahAndrw wrote:
One thing I am unsure of is it says operators :: and -> do not exist.

Now if had a pointer to a struct, which had a member called foo, how would you access it.
myStruct.foo; // compiler detects myStruct is a pointer and all is good
or
(*myStruct).foo;

Both would work. All scoping is done via the dot. To do a copy, and both are pointers, you'd do
Code:
(*myStruct) = (*mySecondStruct)


MessiahAndrw wrote:
EDIT: It seems like the hard work is done for me http://www.dsource.org/projects/nonagon ... on/d3d9d.d :)

Hey, I know personally the guy who wrote that. I have a class with him Tuesdays and Thursdays. He wrote some of our initial stub code for the OS. The world is very small.


Top
 Profile  
 
 Post subject: Re: OS in D language
PostPosted: Thu Jan 29, 2009 5:00 am 
Offline
Member
Member
User avatar

Joined: Mon Jun 05, 2006 11:00 pm
Posts: 2293
Location: USA (and Australia)
quanganht wrote:
Then a D wiki page will appear ! :)


Though I'd love to work on my OS, I have other stuff to do, so I decided to to start working on it again until I can do a full port to D (hopefully with the help of your wiki page).

_________________
My OS is Perception.


Top
 Profile  
 
 Post subject: Re: OS in D language
PostPosted: Thu Jan 29, 2009 7:48 am 
Offline
Member
Member
User avatar

Joined: Fri May 16, 2008 7:13 pm
Posts: 301
Location: Hanoi, Vietnam
I installed Cygwin again today. And as I'm surfing the list under 'Devel', I saw there was 'gcc-gdd : D compiler' =P~ . Unbelievable. When did Cygwin add that option, and I don't even know about it :lol: . Testing now. I guess gdc will be include in gcc source code soon ~> cross-compiler no longer be the problem !

_________________
"Programmers are tools for converting caffeine into code."


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 77 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6  Next

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 25 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group