Page 1 of 2
Objective-C
Posted: Thu Sep 06, 2007 6:27 am
by elderK
Just curious if anyone has had any success with developing (or playing) with a Kernel developed in Objective-C.
It seems like a lovely language but, Objects I create... seem to need to inherit from a Root class (NSObject or GNUStep's Object). So, I need to figure out HOW that works.
Specifically
How I can allocate all the stuff needed, so I can use ObjC in a freestanding environment.
Any information, or advice would be appreciated!
~Zeii.
Posted: Thu Sep 06, 2007 7:53 am
by Colonel Kernel
This might have some answers for you. I've barely begun to scratch the surface of Objective-C, so I can't give any more specific tips...
Posted: Fri Sep 07, 2007 4:46 pm
by R2_
OSDev is obj-c is possible.. just look at the iphone hacks.. you'll notice only the core parts of the OS are written in C. Im guessing you can use gcc objective-c compiler to compile the kernel..
Posted: Fri Sep 07, 2007 5:08 pm
by Alboin
IIRC, Objective C with GCC requires an extra support library, correct? If so, you might have problems with that...
Posted: Sat Sep 08, 2007 2:26 am
by elderK
Aye, it requres the OBJC Library.
In any case, thanks for the link Kernel, it was very, very useful.
~Z
Posted: Sat Sep 08, 2007 8:36 pm
by binutils
Posted: Sun Sep 09, 2007 12:50 am
by Colonel Kernel
I don't know much about D, but I get the sense that its OO features are more "to the metal" than Objective-C's. To put it another way, I'd put D closer to C++ than to Objective-C on the "abstraction spectrum". I like Objective-C, but I'm not sure that its OO features would be very helpful (or lightweight enough) in low-level kernel code. D might actually be a better fit.
I think Objective-C rocks as a language for developing applications, though.
Posted: Sun Sep 09, 2007 1:01 am
by Candy
D is very good at pretending to be better than all the other languages and having a very harsh and stable user base that uses it. I don't know many D programmers though and I haven't seen it suggested anywhere outside of hobby contexts so I can't vouch for its qualities.
Posted: Sun Sep 09, 2007 1:35 am
by AndrewAPrice
Candy wrote:
D is very good at pretending to be better than all the other languages and having a very harsh and stable user base that uses it. I don't know many D programmers though and I haven't seen it suggested anywhere outside of hobby contexts so I can't vouch for its qualities.
Are they people who've compared D to other languages? Or those who assume "D is after C in the alphabet so it must be better"?
I like C/C++ mostly because nearly every API/Library is written for it. When you're up to the stage you can efficiently write in any language (be it C++, D, Java, C#) then creating algorithms and using things such as OpenGL are as equally challenging in all languages. Granted, some languages may have wrappers with make OpenGL either, while some do not and you have to directly interface with shared libraries (it sucks when you have to call .dll functions which you don't know the name of and all the helper functions are in a binary library which you can't link because the only compiler for the language uses a native object format and even if you could link with it the library requires specific C++ features which are implemented entirely differently in your language).
Posted: Thu Sep 13, 2007 6:31 pm
by speal
I've actually been working on porting some of my C++ OS code over to D. I have to say, the startup time for working in D was a big headache. The language relies heavily on a library that is system specific, and you can't even use arrays without some amount of runtime support.
That said, it's not hard to port the bare minimum of runtime support, and I've had a really pleasant time working in this language. You get a lot of good things for free (array slicing would be the big one), and the OO isn't as bloated as C++. I'd suggest giving it a shot.
Array bounds checking, delegates (like function pointers, but for class instances), array slicing, contract programming (asserts that will dump source-file line numbers to screen), nicer templates, and tuples are all great things to play with.
Take a look at my project here:
http://trac.devlime.com/neptune
Finally, the community at
http://www.dsource.org is very helpful if you do decide to go down this path, and run into some language-related issues.
Posted: Fri Sep 14, 2007 12:22 am
by Solar
speal wrote:Array bounds checking, delegates (like function pointers, but for class instances), array slicing, contract programming (asserts that will dump source-file line numbers to screen), nicer templates, and tuples are all great things to play with.
Out of interest... which of these you consider to be not easily doable in C++/STL?
Posted: Fri Sep 14, 2007 2:24 am
by pcmattman
Array bounds checking, delegates (like function pointers, but for class instances), array slicing, contract programming (asserts that will dump source-file line numbers to screen), nicer templates, and tuples are all great things to play with.
Out of interest... which of these you consider to be not easily doable in C++/STL?
Just asking, because I don't know myself (others may benefit), but where could we find a version of the STL that we could port to our own kernels (or possibly userland programs?).
Posted: Fri Sep 14, 2007 2:37 am
by Solar
Jnc100's OS_Specific_Toolchain includes tipps on how to port newlib / libgcc / libstdc++.
Posted: Fri Sep 14, 2007 6:35 am
by Brynet-Inc
He did a good job on that tutorial, Anyone know when it'll be moved into a permanent location?
Posted: Fri Sep 14, 2007 7:05 am
by Solar
Have a look at the discussion page. He PM'ed a couple of us, inquiring how / where to integrate his tutorial, with regards to existing stuff like GCC Cross-Compiler and Porting Newlib.