Re: Ptr and ForeignPtr Questions
At 2001-09-23 00:45, Manuel M. T. Chakravarty wrote:
No, unfortunately not. Consider, for example, that storage qualifiers would have to be generated correctly and there is no way to determine form a Haskell type whether a `const' modifier needs to be added.
I would assume that Ptr types would always be mapped to non-const pointers. Do you have an example of a Haskell type for a foreign import function, for which the corresponding C function type would be ambiguous? -- Ashley Yakeley, Seattle WA
Ashley Yakeley <ashley@semantic.org> wrote,
At 2001-09-23 00:45, Manuel M. T. Chakravarty wrote:
No, unfortunately not. Consider, for example, that storage qualifiers would have to be generated correctly and there is no way to determine form a Haskell type whether a `const' modifier needs to be added.
I would assume that Ptr types would always be mapped to non-const pointers. Do you have an example of a Haskell type for a foreign import function, for which the corresponding C function type would be ambiguous?
Take, for example, the following excerpt of the Linux man pages STRCAT(3) Linux Programmer's Manual STRCAT(3) NAME strcat, strncat - concatenate two strings SYNOPSIS #include <string.h> char *strcat(char *dest, const char *src); char *strncat(char *dest, const char *src, size_t n); If you want to bind these functions from Haskell, you have to deal with `const' qualifiers. The same holds for many other functions in existing C libraries. Manuel
participants (2)
-
Ashley Yakeley -
Manuel M. T. Chakravarty