 |
 |
CFM Carbon cant use CLI? [system()]
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Sep 2000
Location: Medford, MA
Status:
Offline
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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.
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |