
Hi, I want to invoke the C-function 'dlsym', which has three possible options for a parameter of type (void*): - NULL - void* to a string, i.e. CString in Haskell - RTLD_NEXT = (void *)(-1) The first two ones are no problem, I can use a CString and 'nullPtr'. For the last one, I have the problem that in the "Next"-case I cannot write pack :: Flag -> CString pack Null = nullPtr pack Name str = str pack Next = #const RTLD_NEXT because there's no way to cast Int to a Ptr -- at least I didn't find any. Unluckily, the C-codes (void *)(-1) even gets expanded by hsc to the literal "4294967295" which can't be right either. So currently I'm facing two possible solutions: pack Next = nullPtr `plusPtr` 4294967295 (expanded from "... #const RTLD_NEXT") or pack Next = nullPtr `plusPtr` (-1) (which is not a good idea since it doesn't use the C-constant) "Ptr" is abstract so I cannot create this Ptr myself. Maybe the Ptr-module just lacks a 'minusOnePtr' similar to 'nullPtr'? -- Volker Stolz * vs@foldr.org * PGP + S/MIME
participants (1)
-
Volker Stolz