Objective-C

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
User avatar
elderK
Member
Member
Posts: 190
Joined: Mon Dec 11, 2006 10:54 am
Location: Dunedin, New Zealand
Contact:

Objective-C

Post 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 :P 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.
User avatar
Colonel Kernel
Member
Member
Posts: 1437
Joined: Tue Oct 17, 2006 6:06 pm
Location: Vancouver, BC, Canada
Contact:

Post 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...
Top three reasons why my OS project died:
  1. Too much overtime at work
  2. Got married
  3. My brain got stuck in an infinite loop while trying to design the memory manager
Don't let this happen to you!
R2_
Member
Member
Posts: 50
Joined: Sat Dec 02, 2006 3:27 pm

Post 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..
User avatar
Alboin
Member
Member
Posts: 1466
Joined: Thu Jan 04, 2007 3:29 pm
Location: Noricum and Pannonia

Post by Alboin »

IIRC, Objective C with GCC requires an extra support library, correct? If so, you might have problems with that...
C8H10N4O2 | #446691 | Trust the nodes.
User avatar
elderK
Member
Member
Posts: 190
Joined: Mon Dec 11, 2006 10:54 am
Location: Dunedin, New Zealand
Contact:

Post by elderK »

Aye, it requres the OBJC Library.

In any case, thanks for the link Kernel, it was very, very useful.

~Z
User avatar
binutils
Member
Member
Posts: 214
Joined: Thu Apr 05, 2007 6:07 am

Post by binutils »

not flame, how about D over obj-c?
D win?
http://en.wikipedia.org/wiki/D_programming_language
User avatar
Colonel Kernel
Member
Member
Posts: 1437
Joined: Tue Oct 17, 2006 6:06 pm
Location: Vancouver, BC, Canada
Contact:

Post by Colonel Kernel »

binutils wrote:not flame, how about D over obj-c?
D win?
http://en.wikipedia.org/wiki/D_programming_language
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. :)
Top three reasons why my OS project died:
  1. Too much overtime at work
  2. Got married
  3. My brain got stuck in an infinite loop while trying to design the memory manager
Don't let this happen to you!
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Post by Candy »

binutils wrote:not flame, how about D over obj-c?
D win?
http://en.wikipedia.org/wiki/D_programming_language
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.
User avatar
AndrewAPrice
Member
Member
Posts: 2309
Joined: Mon Jun 05, 2006 11:00 pm
Location: USA (and Australia)

Post by AndrewAPrice »

Candy wrote:
binutils wrote:not flame, how about D over obj-c?
D win?
http://en.wikipedia.org/wiki/D_programming_language
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).
My OS is Perception.
speal
Member
Member
Posts: 43
Joined: Wed Mar 07, 2007 10:09 am
Location: Minneapolis, Minnesota
Contact:

Post 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.
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Post 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?
Every good solution is obvious once you've found it.
pcmattman
Member
Member
Posts: 2566
Joined: Sun Jan 14, 2007 9:15 pm
Libera.chat IRC: miselin
Location: Sydney, Australia (I come from a land down under!)
Contact:

Post 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?).
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Post by Solar »

Jnc100's OS_Specific_Toolchain includes tipps on how to port newlib / libgcc / libstdc++.
Every good solution is obvious once you've found it.
User avatar
Brynet-Inc
Member
Member
Posts: 2426
Joined: Tue Oct 17, 2006 9:29 pm
Libera.chat IRC: brynet
Location: Canada
Contact:

Post by Brynet-Inc »

Solar wrote:Jnc100's OS_Specific_Toolchain includes tipps on how to port newlib / libgcc / libstdc++.
He did a good job on that tutorial, Anyone know when it'll be moved into a permanent location?
Image
Twitter: @canadianbryan. Award by smcerm, I stole it. Original was larger.
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Post 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.
Every good solution is obvious once you've found it.
Post Reply