Article View: comp.sys.mac.programmer.codewarrior
Article #1065Re: mach/mach.h and IOKit functions
From: petrock99
Date: Fri, 08 Feb 2002 12:27
Date: Fri, 08 Feb 2002 12:27
42 lines
3636 bytes
3636 bytes
>> Does CW7 support directly calling functions from IOKit?
>
> No, Pro 7 doesn't support this.
You definitely can call IOKit functions from a CW project, you just have
to have the right frameworks/headers/libraries linked in. I recently added
code to one of my projects that would gather a bunch of info on the
processor(s) that my app was running on (i.e. Bus speed, CPU speed, , cache
size/tupe, CPU version etc etc). The only way to do that in a Mach-O app is
through IOKit... You can use a command line tool called ioreg to help you
figure out what keys to use etc... There is also the IORegistryExplorer in
/Developer/Applications that does pretty much the same thing as ioreg, but
with a GUI.
The project is currently at work, I'll post up any funky settings I had
tomorrow...
>> I'm getting link errors, working with the mach-o stationery.
>> The project includes System, IOKit, and CoreFoundation frameworks.
There are a couple bugs in the CW7 Mach-O project stationary. One I
remember was the crt1.o file wasn't being recognized (you could tell cause
it had n/a next to its name in the project list, not a number). This was a
file mapping issue. Just add .o to the file mapping (set it to Mach-O
Linker, IMS).
>> When I #define DARWIN in a prefix file, most errors go away
>> but a few remain - link errors for any mach.h function,
>> and also link errors I don't understand like:
>> ___mod2u is undefined
>> ___div2u is undefined
>
> Move the MSL Runtime and crt1.o files to the end of the link order and
> it might fix this.
This might help, but those are functions defined in runtime.c (inside
CW). It should have been exported in the Runtime projects (bug?)... The
way I got around it was just by adding runtime.c to my project...
>> Has anyone out there directly called mach.h functions with CW7?
>> If so, any clue as to what I'm missing?
yes... Its most likely an include path issue... Do you have
/usr/include in your access paths? I'll take a look at my project
tomorrow..... Good luck...
--Rob
Technical Details
Message-ID:
<B889043E.1AB3%petrock99-NOSPAM@hotmail.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!cpk-news-hub1.bbnplanet.com!news.gtei.net!newscon02.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!postmaster.news.prodigy.com!newssvr21.news.prodigy.com.POSTED!not-for-mailReferences:
<3C602717.27F3AA60@vernier.com> <wankerl-3A87A1.14210406022002@news.mtwk.sps.mot.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10bcce,d90ff54a1a5a9456 X-Google-Attributes: gid10bcce,public X-Google-Thread: f635e,d90ff54a1a5a9456 X-Google-Attributes: gidf635e,public X-Google-ArrivalTime: 2002-02-08 04:28:05 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!cpk-news-hub1.bbnplanet.com!news.gtei.net!newscon02.news.prodigy.com!newsmst01.news.prodigy.com!prodigy.com!postmaster.news.prodigy.com!newssvr21.news.prodigy.com.POSTED!not-for-mail User-Agent: Microsoft-Entourage/10.0.0.1331 Subject: Re: mach/mach.h and IOKit functions From: petrock99 <petrock99-NOSPAM@hotmail.com> Newsgroups: comp.sys.mac.programmer.codewarrior,codewarrior.mac Message-ID: <B889043E.1AB3%petrock99-NOSPAM@hotmail.com> References: <3C602717.27F3AA60@vernier.com> <wankerl-3A87A1.14210406022002@news.mtwk.sps.mot.com> Mime-version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-transfer-encoding: 7bit Lines: 44 NNTP-Posting-Host: 64.166.227.10 X-Complaints-To: abuse@prodigy.net X-Trace: newssvr21.news.prodigy.com 1013171265 ST000 64.166.227.10 (Fri, 08 Feb 2002 07:27:45 EST) NNTP-Posting-Date: Fri, 08 Feb 2002 07:27:45 EST Organization: Prodigy Internet http://www.prodigy.com X-UserInfo1: OH]YBTOGZRSYRWH]]RKB_UDAZZ\DPCPDLXUNNHPHBATBTSUBYFWEAE[YJLYPIWKHTFCMZKVMB^[Z^DOBRVVMOSPFHNSYXVDIE@X\BUC@GTSX@DL^GKFFHQCCE\G[JJBMYDYIJCZM@AY]GNGPJD]YNNW\GSX^GSCKHA[]@CCB\[@LATPD\L@J\\PF]VR[QPJN Date: Fri, 08 Feb 2002 12:27:45 GMT