Re: [Haskell-cafe] [Haskell] Linker flags for foreign export.

2011-03-14 Thread Max Bolingbroke
On 13 March 2011 22:02, Jason Dusek jason.du...@gmail.com wrote:  Is there any case in which the empty string would be unsafe? AFAIK this stuff is only used to setup the +RTS options and some of the stuff in System.Environment. I think that the contents of the program name will only cause

Re: [Haskell-cafe] [Haskell] Linker flags for foreign export.

2011-03-13 Thread Jason Dusek
I have managed to get both static and dynamic to work on Ubuntu; and I've set aside a repo on Github to collect notes on this stuff as I work out building on various systems. https://github.com/solidsnack/hso I need rpath for the dynamic-dynamic case on Ubuntu: ghc -shared

Re: [Haskell-cafe] [Haskell] Linker flags for foreign export.

2011-03-11 Thread Jason Dusek
I now have it working for static-static on Linux; but not with dynamic anything yet. Thanks for all your help. -- Jason Dusek ()  ascii ribbon campaign - against html e-mail /\  www.asciiribbon.org   - against proprietary attachments ___

Re: [Haskell-cafe] [Haskell] Linker flags for foreign export.

2011-03-10 Thread Max Bolingbroke
On 10 March 2011 04:04, Jason Dusek jason.du...@gmail.com wrote:  I'm trying to hew relatively close to Duncan Coutts'  blog posting in working through this; so I have different  code and a new Makefile: Starting with your code I've managed to make it work (OS X 10.6, GHC 7). The Makefile is:

Re: [Haskell-cafe] [Haskell] Linker flags for foreign export.

2011-03-09 Thread Jason Dusek
On Tue, Mar 8, 2011 at 08:23, Max Bolingbroke batterseapo...@hotmail.com wrote: On 8 March 2011 05:28, Jason Dusek jason.du...@gmail.com wrote:    gcc -g -Wall -O2 -fPIC -Wall -o import \      -I/usr/lib/ghc-6.12.1/include/ \      import.c exports.so In my experience, the easiest way to do

Re: [Haskell-cafe] [Haskell] Linker flags for foreign export.

2011-03-09 Thread Max Bolingbroke
Hi Jason,  Following your advice, I was able to get a working main,  linking the .o's (no attempt at an SO this time) with GHC. I haven't tried it, but how about this: 1. Use ghc to link a standard Haskell executable that requires your libraries. Run the link step with -v so you can see the

Re: [Haskell-cafe] [Haskell] Linker flags for foreign export.

2011-03-09 Thread Jason Dusek
I've gleaned a little bit of useful info from looking at what GHC spits out with -v; I found that ordering the libraries in the way they do it makes one of my undefined symbols (`hs_free_stable_ptr') go away. However, my library ends up with a couple undefined __stginit_* symbols

Re: [Haskell-cafe] [Haskell] Linker flags for foreign export.

2011-03-08 Thread Max Bolingbroke
Hi Jason, On 8 March 2011 05:28, Jason Dusek jason.du...@gmail.com wrote:    gcc -g -Wall -O2 -fPIC -Wall -o import \      -I/usr/lib/ghc-6.12.1/include/ \      import.c exports.so In my experience, the easiest way to do this is to use gcc to build object files from C source files, and then