Am Sonntag 23 November 2008 22:32:30 schrieb Dennis Ruffer:
> I'm trying to use the new C interface, but I ran into trouble really
> quickly.
>
> Perhaps there is something I am missing?

Yes, you want to link to libIOKit (see the add-lib word), and you mistake that 
mach_task_t and derived are addresses (they are integers). I've made this 
slight modifications, and your test runs fine (which means it does not abort, 
since there isn't anything useful).

\ Translated from Developer/Examples/IOKit/usb/USBSimple Example source

s" IOKit" add-lib
\c #include <mach/mach.h>
\c #include <CoreFoundation/CFNumber.h>
\c #include <IOKit/IOKitLib.h>
\c #include <IOKit/IOCFPlugIn.h>
\c #include <IOKit/usb/IOUSBLib.h>

c-function IOMasterPort IOMasterPort n a -- n
c-function mach_task_self mach_task_self -- a
c-function mach_port_deallocate mach_port_deallocate n n -- n

variable masterPort             0 masterPort !

: test ( -- )
        0 masterPort IOMasterPort abort" Could not create master port"
        mach_task_self masterPort mach_port_deallocate drop ;


-- 
Bernd Paysan
"If you want it done right, you have to do it yourself"
http://www.jwdt.com/~paysan/

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to