Arc Forumnew | comments | leaders | submitlogin
anarki ffi for Mac OS X
3 points by jimm 6028 days ago | 1 comment
I have a proposal for changing ffi.arc so w/inline will work on Mac OS X. (Note: I tried committing my change, but "git push" says "fatal: The remote end hung up unexpectedly" though "git pull" works fine.)

Here's my proposal to change the definition of w/inline to the following:

  (let is-macosx (is "Darwin" (trim (tostring:system "uname") 'end))
    (= gcc-shared-opts* (if is-macosx "-dynamic -bundle" "--shared")
       gcc-shared-exten* (if is-macosx ".dylib" ".so")))

  (mac w/inline (code . body) ; catches ffi
  (w/uniq (u filename f)
    `(withs
         (,u        (uniq)
                    ,filename (string ,u ".c"))
       (w/outfile ,f ,filename
                  (w/stdout ,f (prn ,code)))
       (prn:tostring:system:string "gcc -O3 -Wall --pedantic --ansi " gcc-shared-opts* " -o " ,u gcc-shared-exten* " " ,u ".c")
       ;(system:string "rm -f " ,u ".c")

       (let ffi (ffi-lib:string ,u)
         ,@body))))
Since I can't commit this, would some kind soul review it and commit it if they like it?


1 point by jimm 6028 days ago | link

Never mind. I figured out how to commit.

-----