FFI
Threads by month
- ----- 2026 -----
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2000 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1999 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 1998 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
October 2000
- 3 participants
- 2 discussions
Ok folks, I decided it's time we woke this list up again.
*kick*
Right. I've got so many things on my ToDo list that come under the heading
of "can't be done until the FFI library is finalized", it's getting silly.
For the time being, I've been using Marcin's library, which I've found to be
suitable for what I'm doing, but I know there are several other libraries
out there to consider. So that we don't get overwhelmed by choices and
design decisions, I suggest we take this one step at a time.
STEP 1: Addr or (Ptr a) ?
I'm convinced that Ptr a is the way to go. After brief conversations with
Manuel at ICFP, I think he's agreed, and presumably Marcin is too (since his
library is based on Ptr a). What do the rest of you think?
Definition of "Ptr a":
A pointer to an object or array of objects which can be
marshalled to, and from, a haskell object of type "a".
Usually "a" will be an instance of "class Storable", which
provides the marshalling code.
Using "Ptr a" eliminates the need for those annoying dummy arguments to
malloc and friends, and provides some useful type safety. It might also in
the future allow us to typecheck our FFI calls with respect to the foreign
interface, but there are still issues to resolve before this can happen.
I've enclosed my modified version of GHC's Storable module, and a new module
Ptr containing the definitions of Ptr and FunPtr (ripped from Marcin's
library mostly). Comments are most welcome.
Cheers,
Simon
begin 600 Ptr.lhs
M+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM
M+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2TM+2T*+2T@)$ED)`HM+2`*
M+2T@*&,I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@.CH@4'1R(&$@+3X@
M26YT("`@("`M/B!A("T^($E/("@I"@D@("`@('!E96LL("`@("`@("`@("`M
M+2`Z.B!0='(@82`@("`@("`@("`@("`@("`@+3X@24\@80H)("`@("!P;VME
M*2`@("`@("`@("`@+2T@.CH@4'1R(&$@("`@("`@("`@("`M/B!A("T^($E/
M("@I"@D)"2`@("`@"@DL(&UA;&QO8RP@("`@("`@("`@("`M+2`Z.B!3=&]R
M86)L92!A(#T^("`@("`@("!)3R`H4'1R(&$I"@DL(&UA;&QO8T%R<F%Y+"`@
M("`@("`M+2`Z.B!3=&]R86)L92!A(#T^($EN="`M/B!)3R`H4'1R(&$I"@DL
M(&UA;&QO8T)Y=&5S+`D@("`@("TM(#HZ("`@("`@("`@("`@("`@26YT("T^
M($E/("A0='(@82D*"0D)("`@("`*"2P@86QL;V-A+"`@("`@("`@("`@("TM
M(#HZ(%-T;W)A8FQE(&$@/3X@("`@("`@("A0='(@82`M/B!)3R!B*2`M/B!)
M3R!B"@DL(&%L;&]C84%R<F%Y+"`@("`@("`M+2`Z.B!3=&]R86)L92!A(#T^
M($EN="`M/B`H4'1R(&$@+3X@24\@8BD@+3X@24\@8@H)+"!A;&QO8V%">71E
M<RP)("`@("`M+2`Z.B`@("`@("`@("`@("`@($EN="`M/B`H4'1R(&$@+3X@
M24\@8BD@+3X@24\@8@H)"0D@("`@(`H)+"!R96%L;&]C07)R87DL("`@("`@
M+2T@.CH@4W1O<F%B;&4@82`]/B!0='(@82`M/B!);G0@+3X@24\@*%!T<B!A
M*0H)+"!R96%L;&]C0GET97,L("`@("`@+2T@.CH@("`@("`@("`@("`@("!0
M='(@82`M/B!);G0@+3X@24\@*%!T<B!A*0H)"0D@("`@(`H)+"!F<F5E("`@
M("`@("`@("`@("`@+2T@.CH@4'1R(&$@+3X@24\@*"D*("`@("`@("`I('=H
M97)E"EQE;F1[8V]D97T*"EQB96=I;GMC;V1E?0II;7!O<G0@4'1R"FEM<&]R
M="!#5'EP97,*:6UP;W)T($-4>7!E<TE33PII;7!O<G0@061D<@D)*"!!9&1R
M+`H)"0DL(')E861);G1/9F9!9&1R+"`@("`@("`@('=R:71E26YT3V9F061D
M<@H)"0DL(')E861!9&1R3V9F061D<BP@("`@("`@('=R:71E061D<D]F9D%D
M9'(*"0D)+"!R96%D1FQO871/9F9!9&1R+"`@("`@("!W<FET949L;V%T3V9F
M061D<@H)"0DL(')E861$;W5B;&5/9F9!9&1R+"`@("`@('=R:71E1&]U8FQE
M3V9F061D<@H)"0DL(')E8617;W)D.$]F9D%D9'(L("`@("`@('=R:71E5V]R
M9#A/9F9!9&1R"@D)"2P@<F5A9%=O<F0Q-D]F9D%D9'(L("`@("`@=W)I=&57
M;W)D,39/9F9!9&1R"@D)"2P@<F5A9%=O<F0S,D]F9D%D9'(L("`@("`@=W)I
M=&57;W)D,S)/9F9!9&1R"@D)"2P@<F5A9%=O<F0V-$]F9D%D9'(L("`@("`@
M=W)I=&57;W)D-C1/9F9!9&1R"@D)"2P@<F5A9$EN=#A/9F9!9&1R+"`@("`@
M("`@=W)I=&5);G0X3V9F061D<@H)"0DL(')E861);G0Q-D]F9D%D9'(L("`@
M("`@('=R:71E26YT,39/9F9!9&1R"@D)"2P@<F5A9$EN=#,R3V9F061D<BP@
M("`@("`@=W)I=&5);G0S,D]F9D%D9'(*"0D)+"!R96%D26YT-C1/9F9!9&1R
M+"`@("`@("!W<FET94EN=#8T3V9F061D<@H)"0DL(')E8613=&%B;&50=')/
M9F9!9&1R+"`@('=R:71E4W1A8FQE4'1R3V9F061D<@H)"0DI"FEM<&]R="!)
M;G0)"2@@26YT."P@($EN=#$V+"`@26YT,S(L("!);G0V-"`@*0II;7!O<G0@
M5V]R9`D)*"!7;W)D."P@5V]R9#$V+"!7;W)D,S(L(%=O<F0V-"`I"FEM<&]R
M="!-;VYA9`D)*"!L:69T32`I"FEM<&]R="!#:&%R("`@("`@("`@("`@("@@
M8VAR+"!O<F0@*0II;7!O<G0@4W1A8FQE4'1R"2@@4W1A8FQE4'1R("D*:6UP
M;W)T($E/17AT<PD)*"!F:7A)3R`I"FEM<&]R="!%>&-E<'1I;VX)*"!B<F%C
M:V5T("D*:6UP;W)T(%!R96Q)3T)A<V4*7&5N9'MC;V1E?0H*4')I;6ET:79E
M(&UA<G-H86QI;F<*"DUI;FEM86P@8V]M<&QE=&4@9&5F:6YI=&EO;CH@<VEZ
M94]F+"!A;&EG;FUE;G0L(&%N9"!O;F4@9&5F:6YI=&EO;@II;B!E86-H(&]F
M('1H92!P965K+W!O:V4@9F%M:6QI97,N"@I<8F5G:6Y[8V]D97T*8VQA<W,@
M4W1O<F%B;&4@82!W:&5R90H*("`@+2T@<VEZ94]F+V%L:6=N;65N="`J;F5V
M97(J('5S92!T:&5I<B!F:7)S="!A<F=U;65N=`H@("!S:7IE3V8@("`@("`Z
M.B!A("T^($EN=`H@("!A;&EG;FUE;G0@("`Z.B!A("T^($EN=`H*("`@+2T@
M<F5P;&%C96UE;G0@9F]R(')E860M+W=R:71E/S\_3V9F061D<@H@("!P965K
M16QE;4]F9B`Z.B!0='(@82`M/B!);G0@("`@("`M/B!)3R!A"B`@('!O:V5%
M;&5M3V9F(#HZ(%!T<B!A("T^($EN="`M/B!A("T^($E/("@I"@H@("`M+2!T
M:&4@<V%M92!W:71H("IB>71E*B!O9F9S971S"B`@('!E96M">71E3V9F(#HZ
M(%!T<B!A("T^($EN="`@("`@("T^($E/(&$*("`@<&]K94)Y=&5/9F8@.CH@
M4'1R(&$@+3X@26YT("T^(&$@+3X@24\@*"D*"B`@("TM("XN+B!A;F0@=VET
M:"!N;R!O9F9S971S(&%T(&%L;`H@("!P965K("`@("`@("`Z.B!0='(@82`@
M("`@("T^($E/(&$*("`@<&]K92`@("`@("`@.CH@4'1R(&$@+3X@82`M/B!)
M3R`H*0H*("`@+2T@8VER8W5L87(@9&5F875L="!I;G-T86YC97,*("`@<&5E
M:T5L96U/9F8@861D<B!O9F8@/2!F:7A)3R`H7'9A;"`M/B!P965K0GET94]F
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('!O:V4@*&-A<W10='(@<'1R.CI0='(@0TEN="D@*&EF(&(@=&AE;B`Q
M(&5L<V4@,"D*("`@('!E96L@<'1R("`@(#T@9&\@:2`\+2!P965K("AC87-T
M4'1R('!T<CHZ4'1R($-);G0I.R!R971U<FX@*&D@+ST@,"D*"FEN<W1A;F-E
M(%-T;W)A8FQE("A0='(@82D@=VAE<F4*("`@('-I>F5/9B`@("`@("`@("`H
M4'1R('@I(#T@<VEZ94]F('@*("`@(&%L:6=N;65N="`@("`@("`H4'1R('@I
M(#T@86QI9VYM96YT('@*("`@('!O:V5%;&5M3V9F(&$@:2`H4'1R('@I(#T@
M<&]K945L96U/9F8@*&-A<W10='(@82D@:2!X"B`@("!P965K16QE;4]F9B!A
M(&D@("`@("`@("`](&QI9G1-(%!T<B`H<&5E:T5L96U/9F8@*&-A<W10='(@
M82D@:2D*"FEN<W1A;F-E(%-T;W)A8FQE("A&=6Y0='(@82D@=VAE<F4*("`@
M('-I>F5/9B`@("`@("`@("`H1G5N4'1R('@I(#T@<VEZ94]F('@*("`@(&%L
M:6=N;65N="`@("`@("`H1G5N4'1R('@I(#T@86QI9VYM96YT('@*("`@('!O
M:V5%;&5M3V9F(&$@:2`H1G5N4'1R('@I(#T@<&]K945L96U/9F8@*&-A<W10
M='(@82D@:2!X"B`@("!P965K16QE;4]F9B!A(&D@("`@("`@("`@("`](&QI
M9G1-($9U;E!T<B`H<&5E:T5L96U/9F8@*&-A<W10='(@82D@:2D*"B-D969I
M;F4@4U1/4D%"3$4H5"QS:7IE+&%L:6=N+')E860L=W)I=&4I"0E<"FEN<W1A
M;F-E(%-T;W)A8FQE("A4*2!W:&5R92"5P*("`@('!E96M%;&5M3V9F("A0='(@82D@
M:2`@(#T@<F5A9"!A(&D["0D)7`H@("`@<&]K945L96U/9F8@*%!T<B!A*2!I
M('@@/2!W<FET92!A(&D@>"!]"@I35$]204),12A);G0L4TE:14]&7TE.5"Q!
M3$E'3DU%3E1?24Y4+`H)(')E861);G1/9F9!9&1R+'=R:71E26YT3V9F061D
M<BD*"E-43U)!0DQ%*$%D9'(L4TE:14]&7U9/241?4"Q!3$E'3DU%3E1?5D])
M1%]0+`H)(')E861!9&1R3V9F061D<BQW<FET94%D9')/9F9!9&1R*0H*4U1/
M4D%"3$4H*%-T86)L95!T<B!A*2Q325I%3T9?5D])1%]0+$%,24=.345.5%]6
M3TE$7U`L"@D@<F5A9%-T86)L95!T<D]F9D%D9'(L=W)I=&53=&%B;&50=')/
M9F9!9&1R*0H*4U1/4D%"3$4H1FQO870L4TE:14]&7T9,3T%4+$%,24=.345.
M5%]&3$]!5"P*"2!R96%D1FQO871/9F9!9&1R+'=R:71E1FQO871/9F9!9&1R
M*0H*4U1/4D%"3$4H1&]U8FQE+%-)6D5/1E]$3U5"3$4L04Q)1TY-14Y47T1/
M54),12P*"2!R96%D1&]U8FQE3V9F061D<BQW<FET941O=6)L94]F9D%D9'(I
M"@I35$]204),12A7;W)D."Q325I%3T9?5T]21#@L04Q)1TY-14Y47U=/4D0X
M+`H)(')E8617;W)D.$]F9D%D9'(L=W)I=&57;W)D.$]F9D%D9'(I"@I35$]2
M04),12A7;W)D,38L4TE:14]&7U=/4D0Q-BQ!3$E'3DU%3E1?5T]21#$V+`H)
M(')E8617;W)D,39/9F9!9&1R+'=R:71E5V]R9#$V3V9F061D<BD*"E-43U)!
M0DQ%*%=O<F0S,BQ325I%3T9?5T]21#,R+$%,24=.345.5%]73U)$,S(L"@D@
M<F5A9%=O<F0S,D]F9D%D9'(L=W)I=&57;W)D,S)/9F9!9&1R*0H*4U1/4D%"
M3$4H5V]R9#8T+%-)6D5/1E]73U)$-C0L04Q)1TY-14Y47U=/4D0V-"P*"2!R
M96%D5V]R9#8T3V9F061D<BQW<FET95=O<F0V-$]F9D%D9'(I"@I35$]204),
M12A);G0X+%-)6D5/1E])3E0X+$%,24=.345.5%])3E0X+`H)(')E861);G0X
M3V9F061D<BQW<FET94EN=#A/9F9!9&1R*0H*4U1/4D%"3$4H26Y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W(@3F]T:&EN9R!2
M97-O=7)C945X:&%U<W1E9"!N86UE(")O=70@;V8@;65M;W)Y(BD*("`@("`@
M96QS92!R971U<FX@861D<@H*9F]R96EG;B!I;7!O<G0@(FUA;&QO8R(@('5N
M<V%F92!?;6%L;&]C("`Z.B`@("`@("`@("!#4VEZ92`M/B!)3R`H4'1R(&$I
M"F9O<F5I9VX@:6UP;W)T(")R96%L;&]C(B!U;G-A9F4@7W)E86QL;V,@.CH@
H4'1R(&$@+3X@0U-I>F4@+3X@24\@*%!T<B!A*0I<96YD>V-O9&5]"@==
`
end
3
2
> - So, it is decided to nuke AddrOff?
I don't think anyone argued in favour of keeping it, so yes.
> - mallocArray/mallocBytes Versus mallocElems: Isn't
> mallocBytes redundant? mallocArray on Word8 should be the
> same, shouldn't it?
True, but might be less convenient because you'd have to explicitly cast the
result type from Ptr Word8 to whatever you wanted. sizeof and alignment
work in units of bytes, so it makes sense to have a version of malloc that
does too.
> Re Ptr:
> - Why call it `ptrPlusBytes' when there is no other
> `ptrPlus'? (I could imagine one, which adds multiples of
> the size of the `a' in `Ptr a'.)
I don't have a preference - maybe call it "plusPtr" to be consistent with
"plusAddr"? Or change them both to "xxxPlus"?
> - Would `freeHaskellFunPtr' replace
> `IOExts.freeHaskellFunctionPtr'?
I don't think it would be a replacement. You have the option of using
FunPtr or Addr for the result of a f.e.d.
Cheers,
Simon
1
0