Re: Kernel Extensions
Re: Kernel Extensions
- Subject: Re: Kernel Extensions
- From: "Justin C. Walker" <email@hidden>
- Date: Mon, 2 Dec 2002 17:22:29 -0800
On Monday, December 2, 2002, at 01:38 PM, Eric Long wrote:
I am discovering the world of kernel extensions and using Project
Builder.
I have some quick questions that I hope someone can easily answer.
1 - In documentation I've been looking at it indicates class methods
should
be declared static. It seems to imply this is for performance reasons.
However, in playing with it, it seems as if methods have to be static
period. I say this because my extension fails loading due to undefined
symbol problems if I don't declare all methods static.
The rules of engagement for C++ in the kernel are somewhat akin to the
limitations for Embedded C++. All compilation for kernel extensions,
whether IOKit gizmos or "just C", must be compiled for static linking.
I can't say whether this requires static declarations of methods, but
you should be able to verify whether that is the norm by checking a few
IOKit projects in the Darwin repository.
2 - I would like to use exceptions.
Sorry; see above (Embedded C++). Exceptions aren't possible for kernel
operation.
I also find it strange that many standard ANSI functions, like
memcmp(), are
unavailable for use in kernel extensions. I don't understand the
reasoning
behind that. Can I even use things like the new and delete operators?
Libc and similar libraries are *not* available in the kernel (for one
thing, the execution environment is much different than that for user
mode). A much-reduced subset is available (cf. libcc_kext.a). Memcmp()
is not in there, so it may just be that no one needed it when it was
written (memcpy() is, for example).
It's worth looking through the code in the darwin repository, while
awaiting further answers, to see what current code does.
Regards,
Justin
--
Justin C. Walker, Curmudgeon-At-Large *
Institute for General Semantics | It's not whether you win or
lose...
| It's whether *I* win or lose.
*--------------------------------------*-------------------------------*
_______________________________________________
darwin-kernel mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/darwin-kernel
Do not post admin requests to the list. They will be ignored.