Re: Re (5): Baffled
Re: Re (5): Baffled
- Subject: Re: Re (5): Baffled
- From: Godfrey van der Linden <email@hidden>
- Date: Fri, 14 Feb 2003 13:10:46 -0800
This clears up lots of things. If you don't build clean and
transition a driver from a NKE to an IOKit module, then the file that
is generated by project builder may not get regenerated. Though I'm
still puzzled because that means that the system doesn't know that
your module contains IOKit classes. Do you subclass any IOKit
classes or do you just use them straight?
If you need a function to be called at load time AND you are
subclassing OSObject, directly or indirectly through IOService, then
I suggest you use static class construction/destruction.
There is a pretty clear cut example on how to do this in
IOSerialFamily/IOSerialFamily.kextproj/IOSerialBSDClient.cpp
Godfrey
At 11:19 -0800 03-2-14, Eric Long wrote:
> I think the problem is that you are trying to use the module start/stop
entry points AND have an I/O Kit driver in the same kext. This isn't
supported, because the C++ runtime hijacks the module start/stop entry
points in order to setup your kext's classes. This is the primary
difference between the "IOKit Driver" and "Generic Kernel Extension"
project templates in ProjectBuilder.
I suspected this was involved. The puzzlement is that I was able to use the
extension for a long time without this problem appearing. Originally, the
extension had no IOKit code. It was just the basic NKE. Later, I added
code to interface with a client app and to allow me to use lots of helpful
IOKit classes in parsing XML preference data passed to me.
Somehow, it worked. Until I trashed the original build folder to build from
scratch, things were peachy.
1) Split your kext into two - one I/O Kit driver, and one generic kext.
2) Relocate the code from your module start/stop routines into init()
and free(), or someplace similar. Be aware that init & free will be
called once for each instance of your class, rather than just once like
module start/stop. This is probably the best choice if you can adapt
your setup teardown code.
3) You may be able to provide a static initializer/destructor with your
class that will be called at module start/stop time. I'll have to
check to see if this is possible, as I've not tried to do it myself.
I'll check that out.
Thanks for clearing things up.
_______________________________________________
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.