I'm trying to use the new C interface, but I ran into trouble really quickly.

Perhaps there is something I am missing?

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

\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 a a -- n

variable masterPort             0 masterPort !

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

Produces:

druffer$ gforth USBSimple.f
Gforth 0.7.0, Copyright (C) 1995-2008 Free Software Foundation, Inc.
Gforth comes with ABSOLUTELY NO WARRANTY; for details type `license'
Type `bye' to exit
test /Users/druffer/.gforth/libcc-tmp/gforth_c_103DEA4.c: In function 'gforth_c_103DEA4_LTX_gforth_c_mach_port_deallocate_aa_n': /Users/druffer/.gforth/libcc-tmp/gforth_c_103DEA4.c:25: warning: passing argument 1 of 'mach_port_deallocate' makes integer from pointer without a cast /Users/druffer/.gforth/libcc-tmp/gforth_c_103DEA4.c:25: warning: passing argument 2 of 'mach_port_deallocate' makes integer from pointer without a cast
dyld: lazy symbol binding failed: Symbol not found: _IOMasterPort
Referenced from: /Users/druffer/.gforth/libcc-tmp/.libs/ gforth_c_103DEA4.0.so
  Expected in: dynamic lookup

dyld: Symbol not found: _IOMasterPort
Referenced from: /Users/druffer/.gforth/libcc-tmp/.libs/ gforth_c_103DEA4.0.so
  Expected in: dynamic lookup


:1: Trace/BPT trap
>>>test<<<
Backtrace:
$102C820 call-c
$102C7B0 execute
$103DFF0 IOMasterPort

DaR


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to