Re: Including headers for clock_get_system_nanotime et al - how ?
Re: Including headers for clock_get_system_nanotime et al - how ?
- Subject: Re: Including headers for clock_get_system_nanotime et al - how ?
- From: André Berg <email@hidden>
- Date: Thu, 25 Sep 2008 02:05:41 +0200
Well, I give up... this is getting most bizarre. Almost everything inside
Kernel.framework (except for IOKit) is not includable. I take it that the
functions I mentioned should not be used. I wonder why Apple incldues them
in their Kernel Programming Guide then.
The last few things I tried:
5. Activating the Kernel Development build setting.
6. Opening the Example project provided by Apple in
/Developer/Examples/Kernel/IOKit/pccard/ ... it includes a file called
dump_cisreg.c which is the only file from the examples I could find that has
a #include <Kernel/....> in it. I copied the build settings one to one but
with no luck. I also tried adding #include <Kernel/kern/clock.h> to the
Apple Example project with no luck... I get the same symbol not found errors
for the clock_get_.... functions or a "<kern/kern_types.h> no such file/s"
error.
A pity really, those timing functions might have come in handy for sure, but
oh well... not worth losing a full day for this.
André
--- Original Nachricht ---
Absender: André Berg
Datum: 24.09.2008 14:17 Uhr
Hi,
I am fairly new to programming with Xcode. I am trying to replicate an
example from the Kernel Programming Guide > Using Kernel Time Abstractions
(http://developer.apple.com/documentation/Darwin/Conceptual/KernelProgramming/services/chapter_16_section_2.html#//apple_ref/doc/uid/TP30000905-CH219-CHDJBFEF)
--------------- snip ---------------
uint32_t secpart;
uint32_t nsecpart;
uint64_t nsec, abstime;
clock_get_calendar_nanotime(&secpart, &nsecpart);
nsec = nsecpart + (1000000000ULL * secpart); //convert seconds to
nanoseconds.
nanoseconds_to_absolutetime(nsec, &abstime);
--------------- snip ---------------
I would also like to use the functions
--------------- snip ---------------
void clock_get_uptime(uint64_t *result);
void clock_get_system_microtime(uint32_t *secs, uint32_t *microsecs);
void clock_get_system_nanotime(uint32_t *secs, uint32_t *nanosecs);
void clock_get_calendar_microtime(uint32_t *secs, uint32_t *microsecs);
void clock_get_calendar_nanotime(uint32_t *secs, uint32_t *nanosecs);
--------------- snip ---------------
but I am having a very hard time including the files necessary for the
linker to reckognize those functions.
Specifically I have tried:
1. "#include <Kernel/kern/clock.h>" which gives me following error message:
In file included from
/Users/andre/Documents/Xcode/CommandLineUtility/CoreServices/abstime/main.c:2:
/Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/Kernel.framework/Headers/kern/clock.h:43:29:
error: kern/kern_types.h: No such file or directory
2. Various settings for the Search Paths section on Project and Target
Build
Settings level did not help. I tried including the /Developer/SDKs souce
dir
recursively.
3. Passing manual flags to the linker like -L</path/to/Kernel.framework>
and
-I</path/to/Kernel.framework> did not help either.
4. Switching on "Build Active Architecture Only" on project and target
level
build settings did not help.
The linker (ld) just either does not find those functions or trip up about
the include file (<kern/kern_types.h>), which is included from
<Kernel/kern/clock.h> which is included in my code.
Xcode however does see where the functions are coming from apparently,
because syntax coloring and cmd-double-clicking on the function names
does work.
My project is very simple, I just set it up for this purpose. The code I
posted first is all the code in main() for the project...
Now, I know I could just use AbsoluteTimeToNanoseconds() and consorts of
CoreServices.framework but I might post the application to Unix/Linux user
groups later so staying within Mach/Kernel.framework would ease the
transition...
I must be overlooking something basic, but I can't see the forest
because of
the trees... maybe you can help?
Even if you can't, I appreciate you investing your valuable time reading
this!
Thanks!
André
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden