[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

my first program on MacOS X and a lot of questions...



Hi,

I am trying to make a "simple" program to eject an Audio CD typing a
keyboard key.

This is a simple idea, so I think about this :

Make a program loaded in the user space which catch the keybord events and
eject the CD.

I created a Cocoa project (I want to learn and use Cocoa).
After I browsed all the frameworks to get the right one (to eject the CD).

It seems that the right API's could be in :

Kernel.framework, which contains interested folders :

cdb and storage.

The storage folder contains these headers :

IOCDDrive.h
IOCDDriveNub.h
IOCDMedia.h
IOCDTypes.h

And in IOCDDrive.h there is a function called ejectMedia().

First difficulty...

It's written in C++, and I saw in others frameworks C, Objective C and now
C++ (called embedded C++ by Apple), so What language to choose ???

Second difficulty...

I read some documentations from the Apple's Web site, "Kernel Environment",
"Project Builder"...
to have a little bit more informations and to create the right project.

What kind of project to choose ?

Cocoa or Kernel Extension ? (or other)

I have a little doubt, when I read the Apple's documentation it is writen
that there is

- One Kernel space and One User space. So there are APIs only for the kernel
space.
Is my eject function right for the user space ?

I think that some Frameworks like IOKIT are only for the kernel space, to
write device drivers. Right ?
How to know if a function is only right for the Kernel Space ?
When I want to create a program for the user space I write a kernel
extension or a module. Right ?

But if I want to use some low level kernel APIs in the user space I have to
use something. It's called "User Client".

The User Client is linked with a CFPlugIn or a Library.

What is a CFPlugIn ? and how to create a User Client ?

So it seems I have to create a User Client linked with a CFPlugIn or Library
to use my eject function.
And I tried this :

1- I created a Cocoa project
2- Included Kernel.framework -> #include <Kernel/IOKit/storage/IOCDDrive.h>

3- A  lot of errors....

header file 'IOKit/storage/IOCDTypes.h' not found
header file 'IOKit/storage/IOHDDrive.h' not found
undefined type, found `class'
undefined type, found `public'
undefined type, found `virtual'
undefined type, found `OSDictionary'
...

I am unable to compile my project, idea ?

Here are all my questions.

I will be very happy if someone could help me.

Thanks a lot and Happy New Year...

Thierry