site_archiver@lists.apple.com Delivered-To: darwin-kernel@lists.apple.com Jason, Cheers, - Dean _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/site_archiver%40lists.a... On Nov 23, 2005, at 2:58 AM, Juncheng Geng wrote: I'm now developing an IOKit driver. Its behaves differently with different MAC OS version. Then my question is how to get system version dynamically when the driver is running. There are several kernel globals defined that will be of use to you. In Tiger, they are defined in the following header: Kernel.framework/ Headers/libkern/version.h. In prior releases, they were not available in any header so people that used them had to provide their own prototypes. If you are building on an SDK eralier than 10.4, you can steal the prototypes from the Tiger header and include them in your own kext. You probably want (int)version_major and (int)version_minor. If you just want to do string compares, you can use (char*)osrelease. The values match the Darwin kernel version (8.0 for Tiger). To link against them, you need to declare com.apple.kernel.libkern or com.apple.kpi.libkern in your OSBundleLibraries property. If you need to load on systems earlier than Tiger, you have to use the former (.kernel.). If you only need to run on Tiger and later, you can choose either .kernel. or .kpi., but you can't mix and match the two library types in a single kext. This email sent to site_archiver@lists.apple.com