ghci and dynamically linking to Objective-C objects on Mac OS X

Hi all,
I fear I might be unaware of something I should be. Say I have a file
objc_util.m with the following contents:
#include

On Sun, Mar 1, 2015 at 1:09 AM, Sean Seefried
However, it doesn't seem like I should have to do this. Where am I going wrong?
My guess is that the linker used by ghci (which is not the system linker, although there is ongoing work on that front) doesn't know how to deal with frameworks properly. You might have better luck turning your .o into a .dylib and linking *that* against the Foundation framework. -- brandon s allbery kf8nh sine nomine associates allbery.b@gmail.com ballbery@sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net

Sure, but shouldn't we perhaps just fix GHCi so that it does deal with
frameworks properly?
On 1 March 2015 at 18:25, Brandon Allbery
On Sun, Mar 1, 2015 at 1:09 AM, Sean Seefried
wrote: However, it doesn't seem like I should have to do this. Where am I going wrong?
My guess is that the linker used by ghci (which is not the system linker, although there is ongoing work on that front) doesn't know how to deal with frameworks properly. You might have better luck turning your .o into a .dylib and linking *that* against the Foundation framework.
-- brandon s allbery kf8nh sine nomine associates allbery.b@gmail.com ballbery@sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net

On Wed, Mar 4, 2015 at 4:34 PM, Sean Seefried
Sure, but shouldn't we perhaps just fix GHCi so that it does deal with frameworks properly?
Maintaining a completely separate linker instead of using the system's linker is a fool's errand that leads to things like this and inability to use ghci or TH on ARM, or having to have someone who does nothing but follow all the changes made to every system linker we care about and porting those changes to ghci's custom linker. The correct fix is the upcoming change to have ghci use the system linker. In the meantime, I offered a workaround. -- brandon s allbery kf8nh sine nomine associates allbery.b@gmail.com ballbery@sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net

Seems like pretty solid reasoning. I was unaware of this upcoming change.
Can you tell me more about it? Which GHC release is it slated for? 7.12?
On 5 March 2015 at 08:39, Brandon Allbery
On Wed, Mar 4, 2015 at 4:34 PM, Sean Seefried
wrote: Sure, but shouldn't we perhaps just fix GHCi so that it does deal with frameworks properly?
Maintaining a completely separate linker instead of using the system's linker is a fool's errand that leads to things like this and inability to use ghci or TH on ARM, or having to have someone who does nothing but follow all the changes made to every system linker we care about and porting those changes to ghci's custom linker. The correct fix is the upcoming change to have ghci use the system linker. In the meantime, I offered a workaround.
-- brandon s allbery kf8nh sine nomine associates allbery.b@gmail.com ballbery@sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net

On Wed, Mar 4, 2015 at 4:42 PM, Sean Seefried
Seems like pretty solid reasoning. I was unaware of this upcoming change. Can you tell me more about it? Which GHC release is it slated for? 7.12?
Well, it was originally scheduled for 7.8. :/ I don't see it in 7.10 offhand, so I presume it got bumped again. -- brandon s allbery kf8nh sine nomine associates allbery.b@gmail.com ballbery@sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net

ghci in 7.8 uses the system linker. However, i suspect you'll find that
linking to the objective c code works better when you COMPILE the haskell
code first, then load in ghci
the way to do this directly from GHCI is to invoke ghci with the
-fobject-code flag. see
https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/ghci-obj.htm...
that may very well resolve your problems (i'm juggling a few other things
right now so I can't immediately verify my claims myself)
On Wed, Mar 4, 2015 at 5:10 PM, Brandon Allbery
On Wed, Mar 4, 2015 at 4:42 PM, Sean Seefried
wrote: Seems like pretty solid reasoning. I was unaware of this upcoming change. Can you tell me more about it? Which GHC release is it slated for? 7.12?
Well, it was originally scheduled for 7.8. :/ I don't see it in 7.10 offhand, so I presume it got bumped again.
-- brandon s allbery kf8nh sine nomine associates allbery.b@gmail.com ballbery@sinenomine.net unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
participants (3)
-
Brandon Allbery
-
Carter Schonwald
-
Sean Seefried