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 > CFM Carbon cant use CLI? [system()]

CFM Carbon cant use CLI? [system()]
Thread Tools
Dedicated MacNNer
Join Date: Sep 2000
Location: Medford, MA
Status: Offline
Reply With Quote
Sep 19, 2001, 01:21 AM
 
I'm writing a compiler plug-in for CodeWarrior 7. The plug-in needs to be CFM code so that the IDE can use it, but I want to run a command line tool. The "system()" call which works so well for this in Mach-O/libstdc++.a code is unimplemented in the CFM carbon libs. This is because silly OS 9 can't use it. Does anyone know how I can run a CLI utility with lots of args from CFM code?

This would make my day.
     
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status: Offline
Reply With Quote
Sep 19, 2001, 12:21 PM
 
I don't see any reason why you shouldn't be able to use CoreFoundation to get a function pointer into libSystem.dylib for system(). RTFM on CFBundle
     
Dedicated MacNNer
Join Date: Sep 2000
Location: Medford, MA
Status: Offline
Reply With Quote
Sep 19, 2001, 02:10 PM
 
I think because CFM and Mach-O deal with function pointers differently, you can't do this. The only way I know to work around this is to use a CFPlugin which i think uses RPC or some marshalled interface between the two.

I know how to do that, but it's a royal pain. I was wondering if there was some shortcut.

Thanks.
     
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status: Offline
Reply With Quote
Sep 20, 2001, 01:43 AM
 
Originally posted by PerfectlyNormalBeast:
<STRONG>I think because CFM and Mach-O deal with function pointers differently, you can't do this. The only way I know to work around this is to use a CFPlugin which i think uses RPC or some marshalled interface between the two.

I know how to do that, but it's a royal pain. I was wondering if there was some shortcut.</STRONG>
You obviously haven't read the manual on CFBundle . I suggest you do so. It is perfectly possible to call functions inside Mach-O libraries from a CFM application using CFBundle. I know someone who has done this to call IOKit from REALbasic.
     
Dedicated MacNNer
Join Date: Sep 2000
Location: Medford, MA
Status: Offline
Reply With Quote
Sep 20, 2001, 05:03 AM
 
Yeah, I meant to reply earlier. I figured this out and got my plug-in to work. You can call Mach-O stuff from CFM if it's in a bundle. I was wrong. The problem is that some of apple's docs that I have, including my slightly dated, hardcopy version of "Inside Mac OS X: System Overview", claim that the only way to do this is through a plug-in. You still can't link against a bundle, but you can query it for symbols, then cast them to a CFM style function ptr. Alternatively you can create a whole stub lib (pain in the rear). I have read through the CFBundle docs. I don't think they say anything about CFM code in them, but I only looked briefly tonight. The way I figured out you could do this is by searching Apple's sample code online. There is a project called "CallMachOFramework" that did pretty much exactly what I needed.
     
   
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 12:17 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