How to get Cabal to spit out a .a library suitable for linking into C/Objective-C

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

How to get Cabal to spit out a .a library suitable for linking into C/Objective-C

David Pollak
Howdy,

I'm trying to figure out how to get Cabal configured to compile and link my Haskell code such that the code can be part of C and/or Objective-C code such that all the Haskell dependencies are rolled into a .a file and can be linked by a normal C linker (e.g., ld).

I've been through http://haskell.org/ghc/docs/6.12.2/html/users_guide/ffi-ghc.html#using-own-main and the associated linked, but I'm unable to find out the Cabal incantation to output a library that's linkable into my other code.  Any pointers or examples would be greatly appreciated.

Thanks,

David

--
Visi.Pro, Cloud Computing for the Rest of Us http://visi.pro
Lift, the simply functional web framework http://liftweb.net



_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: How to get Cabal to spit out a .a library suitable for linking into C/Objective-C

Jason Dagit-3
Did you figure out what you need to know?  If not, I would suggest
asking this same question but on StackOverflow (assuming you haven't
already asked there).

Jason


On Mon, Dec 19, 2011 at 2:35 PM, David Pollak
<[hidden email]> wrote:

> Howdy,
>
> I'm trying to figure out how to get Cabal configured to compile and link my
> Haskell code such that the code can be part of C and/or Objective-C code
> such that all the Haskell dependencies are rolled into a .a file and can be
> linked by a normal C linker (e.g., ld).
>
> I've been
> through http://haskell.org/ghc/docs/6.12.2/html/users_guide/ffi-ghc.html#using-own-main
> and the associated linked, but I'm unable to find out the Cabal incantation
> to output a library that's linkable into my other code.  Any pointers or
> examples would be greatly appreciated.
>
> Thanks,
>
> David
>
> --
> Visi.Pro, Cloud Computing for the Rest of Us http://visi.pro
> Lift, the simply functional web framework http://liftweb.net
> Follow me: http://twitter.com/dpp
> Blog: http://goodstuff.im
>
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> [hidden email]
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: How to get Cabal to spit out a .a library suitable for linking into C/Objective-C

David Pollak


On Mon, Jan 16, 2012 at 1:32 PM, Jason Dagit <[hidden email]> wrote:
Did you figure out what you need to know?

Sadly, no.
 
 If not, I would suggest
asking this same question but on StackOverflow (assuming you haven't
already asked there).

Great suggestion.  Thanks!
 

Jason


On Mon, Dec 19, 2011 at 2:35 PM, David Pollak
<[hidden email]> wrote:
> Howdy,
>
> I'm trying to figure out how to get Cabal configured to compile and link my
> Haskell code such that the code can be part of C and/or Objective-C code
> such that all the Haskell dependencies are rolled into a .a file and can be
> linked by a normal C linker (e.g., ld).
>
> I've been
> through http://haskell.org/ghc/docs/6.12.2/html/users_guide/ffi-ghc.html#using-own-main
> and the associated linked, but I'm unable to find out the Cabal incantation
> to output a library that's linkable into my other code.  Any pointers or
> examples would be greatly appreciated.
>
> Thanks,
>
> David
>
> --
> Visi.Pro, Cloud Computing for the Rest of Us http://visi.pro
> Lift, the simply functional web framework http://liftweb.net
> Follow me: http://twitter.com/dpp
> Blog: http://goodstuff.im
>
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> [hidden email]
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>



--
Visi.Pro, Cloud Computing for the Rest of Us http://visi.pro
Lift, the simply functional web framework http://liftweb.net



_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: How to get Cabal to spit out a .a library suitable for linking into C/Objective-C

Jeremy O'Donoghue
Hi David,
 
On 20 January 2012 22:34, David Pollak <[hidden email]> wrote:
On Mon, Jan 16, 2012 at 1:32 PM, Jason Dagit <[hidden email]> wrote:
Did you figure out what you need to know?

Sadly, no.
 
 If not, I would suggest
asking this same question but on StackOverflow (assuming you haven't
already asked there).
 
I missed this question the first time around. Sorry.
 
I don't have a canned answer to your question, but on the wxHaskell team we have recently been working on (ab)using Cabal to produce shared libraries, and almost everything is just as applicable to static libraries. It's not all working yet, but some of the following pointers might help you to understand how to make Cabal linking configurable.
 
 
Great suggestion.  Thanks!
 
On Mon, Dec 19, 2011 at 2:35 PM, David Pollak
<[hidden email]> wrote:
> Howdy,
>
> I'm trying to figure out how to get Cabal configured to compile and link my
> Haskell code such that the code can be part of C and/or Objective-C code
> such that all the Haskell dependencies are rolled into a .a file and can be
> linked by a normal C linker (e.g., ld).
>
> I've been
> through http://haskell.org/ghc/docs/6.12.2/html/users_guide/ffi-ghc.html#using-own-main
> and the associated linked, but I'm unable to find out the Cabal incantation
> to output a library that's linkable into my other code.  Any pointers or
> examples would be greatly appreciated.
>
> Thanks,
>
> David
 
Best regards
Jeremy 

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe