[Haskell-cafe] How to return a network connection to C

Krzysztof Skrzętnicki gtener at gmail.com
Thu Feb 28 19:28:31 CET 2013


If I understand you correctly you need a StablePtr to your Connection
value. Please see:
http://www.haskell.org/ghc/docs/latest/html/libraries/base-4.6.0.1/Foreign-StablePtr.html

Best regards,
Krzysztof Skrzętnicki


On Thu, Feb 28, 2013 at 6:31 PM, C K Kashyap <ckkashyap at gmail.com> wrote:

> I am using http://hackage.haskell.org/package/connection.
> So I create network connection in Haskell
>
> getConnection :: IO Connection
>
> I'd like this connection to be returned to C so that subsequent calls from
> C can send in the connection handle.
>
> Regards,
> Kashyap
>
>
> On Thu, Feb 28, 2013 at 9:04 PM, Niklas Hambüchen <mail at nh2.me> wrote:
>
>> What data type are you dealing with exactly?
>>
>> If you have a socket, I guess you can just use it from C (via FFI).
>>
>> PS:
>> By "Network.Connection", do you mean
>> http://hackage.haskell.org/package/network-connection-0.1.1 ? Seems
>> deprecated.
>>
>> On 28/02/13 06:14, C K Kashyap wrote:
>> > Hi,
>> > I am using Network.Connection to connect to gmail in my Haskell module -
>> > that's compiled to DLL and invoked from C.
>> >
>> > I need a mechanism to return the connection handle to C so that it can
>> > pass it in the subsequent calls. How can I achieve this?
>> >
>> > Regards,
>> > Kashyap
>> >
>> >
>> > _______________________________________________
>> > Haskell-Cafe mailing list
>> > Haskell-Cafe at haskell.org
>> > http://www.haskell.org/mailman/listinfo/haskell-cafe
>> >
>>
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130228/6a714182/attachment.htm>


More information about the Haskell-Cafe mailing list