Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Help! Problem linking to Kernel.framwork

Help! Problem linking to Kernel.framwork
Thread Tools
Dedicated MacNNer
Join Date: Sep 2000
Location: Medford, MA
Status: Offline
Reply With Quote
May 8, 2001, 06:19 PM
 
I'm writing a gui-less server app with complicated threading and I need access to atomic integer operations. On MacOS X these seemed to be as follows decared in <kern/simple_lock.h>:

int hw_atomic_add(int *area, int inc);
int hw_atomic_sub(int *area, int dec);
unsinged int hw_compare_and_store(unsigned int oldValue, unsigned int newValue, unsigned int *area);

These would be all I need, however, I can't seem to link to the Kernel.framworks. I include it in my project builder project, but I get:

"ld: can't locate framework for: -framwork Kernel"

I don't think it's a search path issue. I've tried explicitly including /System/Library/Framworks but to no avail. Also, I have no trouble linking to openssl.framwork.

What don't I know? I could use mutexes to get around the atomic op issue, but frankly OS X is slow enough. ;-)

I also wish the pthreads implementation was a bit more full featured. I know it meets the spec, but it's hard to deal with if you're porting from platforms with nicities like pthread_suspend and pthread_resume, or god-forbid, recursive mutexes.

I wish my company would shell out for a nice ADC membership, but they're still not sold on OS X yet as a target platform. The port is my personal work.

Thanks in advance!
     
Fresh-Faced Recruit
Join Date: Apr 2001
Status: Offline
Reply With Quote
May 8, 2001, 06:24 PM
 
Hey-
I've had the same problem as well trying to compile a few apps. AFAIK, there is no real Kernel.framework library. Normally inside a framework you have a <framework>.framework/<framework> file, where <framework> is the name of the framework (did I say "framework" enough times?). Anyway, AFAICT, that is the library for the framework. Kernel.framework does not have it, so my advice is to go into Kernel.framework/Headers, and search through the headers there for the functions you need.

Hope this helps.

mccullocht
     
Dedicated MacNNer
Join Date: Sep 2000
Location: Medford, MA
Status: Offline
Reply With Quote
May 8, 2001, 06:44 PM
 
hmm... interesting...

This would kinda make sense. I found the header. It's /System/Library/Frameworks/Kernel.frameworks/Headers/kern/simple_lock.h. If I just include that header, it tells me it can't find the code for the functions. I have to link against some library where they are defined. I'll keep poking around. Grr...
     
Dedicated MacNNer
Join Date: Sep 2000
Location: Medford, MA
Status: Offline
Reply With Quote
May 8, 2001, 06:47 PM
 
Maybe these functions are just for programming in kernel space? Eeek, that would be lousy.
     
Fresh-Faced Recruit
Join Date: Apr 2001
Status: Offline
Reply With Quote
May 8, 2001, 07:19 PM
 
Hmm...you may very well be correct in your assessment that they are kernel-only functions. But you might also want to check out /usr/lib/libSystem.dylib. It's got several main libs compiled into it (libcurses, libm, and more), so this might have the functions you are looking for. It that doesn't work, try looking through apple's kernel docs, which are buried under /System/Library/Frameworks/Kernel.framework/Versions/A/Resources/English.lproj/Documentation/Reference/Kernel .
     
Dedicated MacNNer
Join Date: Sep 2000
Location: Medford, MA
Status: Offline
Reply With Quote
May 8, 2001, 07:29 PM
 
No joy there. But thanks for trying.

I guess I'll just use a mutex.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 10:01 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2