Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Programming / CodeWarrior / July 2004



Tip: Looking for answers? Try searching our database.

Porting Shared memory Cocoa/Objective-C app  to Mach-O...Possible?  

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bob Freeman - 30 Jul 2004 15:04 GMT
The Apple developer site has a shared memory sample app, using the SHM Unix
modules, written in Objective C, under Cocoa. I want to implement shared
memory under C++/Mach-o.... do I need to start from scratch or can I somehow
port the sample app over... any direction, tips, comments would be most
appreciated.....

Signature

-------------------------------------------------------------------
Bob Freeman
Experience Technology Inc.
(905)-383-7086        Cell: (905)-517-4966

Paul - 30 Jul 2004 15:33 GMT
> The Apple developer site has a shared memory sample app, using the SHM Unix
> modules, written in Objective C, under Cocoa. I want to implement shared
> memory under C++/Mach-o.... do I need to start from scratch or can I somehow
> port the sample app over... any direction, tips, comments would be most
> appreciated.....

There's a word for people who reference stuff  like this and don't include
URL's  ;  )
I presume you mean
http://developer.apple.com/samplecode/SharedMemory/listing3.html ?

Looking over it, it appears that shmget and  the semaphore stuff are pure C
API's  being used in a Cocoa program. You'll have to convert NSThread to
another type (depending on what you're doing, but you'll have to do that
anyway.)

Otherwise, get rid of all the Objective-C UI code and translate a few things
(the NSString stuff in sem_open), and you'll be off to a good start. If you
don't do Objective-C, spend an hour or two with Apple's Intro PDF and you'll
be ready for the next time.

While searching, I also came across (in tech note 2071 about porting command
line tools):

shmget
This API is supported but its use is not recommended. shmget has a limited
memory blocks allocation. When several applications use shmget, this limit
may change and cause problems for the other applications. We recommend the
use of mmap for file mapping into memory.

This may not apply to you and/or mmap may not be appropriate, but be aware
of it.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.