Send Beginners mailing list submissions to beginners@haskell.org To subscribe or unsubscribe via the World Wide Web, visit http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners or, via email, send a message with subject or body 'help' to beginners-requ...@haskell.org
You can reach the person managing the list at beginners-ow...@haskell.org When replying, please edit your Subject line so it is more specific than "Re: Contents of Beginners digest..." Today's Topics: 1. ffi array and peekArray (PICCA Frederic-Emmanuel) 2. (no subject) (Olivier TOURNAIRE) 3. Re: (no subject) (Imants Cekusins) ---------------------------------------------------------------------- Message: 1 Date: Sun, 8 Nov 2015 09:55:30 +0000 From: PICCA Frederic-Emmanuel <frederic-emmanuel.pi...@synchrotron-soleil.fr> To: "beginners@haskell.org" <beginners@haskell.org> Subject: [Haskell-beginners] ffi array and peekArray Message-ID: <a2a20ec3b8560d408356cac2fc148e53b2fad...@sun-dag3.synchrotron-soleil.fr> Content-Type: text/plain; charset="us-ascii" Hello, Here the signature of one of my C function -- hkl.h -- typedef struct _HklFactory HklFactory; HKLAPI HklFactory **hkl_factory_get_all(size_t *n) HKL_ARG_NONNULL(1); HKLAPI HklFactory *hkl_factory_get_by_name(const char *name, GError **error) HKL_ARG_NONNULL(1) HKL_WARN_UNUSED_RESULT; HKLAPI const char *hkl_factory_name_get(const HklFactory *self) HKL_ARG_NONNULL(1); HKLAPI HklGeometry *hkl_factory_create_new_geometry(const HklFactory *self) HKL_ARG_NONNULL(1); HKLAPI HklEngineList *hkl_factory_create_new_engine_list(const HklFactory *self) HKL_ARG_NONNULL(1); I will focuss for now only the get_all method. As you can see even for the C client of my API HklFactory is an opac struct This get_all method return an array of (HklFactory *) and get the size of the array via the n parameter. So I am trying to use this API from haskell with the foreign system and return a [HklFactory] import Foreign (Ptr, peek) import Foreign.Marshal.Alloc (alloca) import Foreign.Marshal.Array (peekArray) data HklFactory foreign import ccall safe "hkl.h hkl_factory_get_all" c_hkl_factory_get_all :: Ptr Int -> IO (Ptr HklFactory) hklFactoryGetAll :: IO [HklFactory] hklFactoryGetAll = alloca $ \n -> do factories <- c_hkl_factory_get_all n peekArray n factories but indeed it doesn not work, peekArray complain that n is Ptr Int instead of Int. what should I do in order to get my array of HklFactory thanks for your help. Frederic ------------------------------ Message: 2 Date: Sun, 8 Nov 2015 10:56:38 +0100 (CET) From: Olivier TOURNAIRE <olivier.tourna...@wanadoo.fr> To: beginners@haskell.org Subject: [Haskell-beginners] (no subject) Message-ID: <860188405.2807.1446976598088.JavaMail.www@wwinf1j16> Content-Type: text/plain; charset=UTF-8 Hello I would like to implement Haskell with a samsung tablet SM T800. How can i do that ? Thank you very much. ------------------------------ Message: 3 Date: Sun, 8 Nov 2015 11:17:27 +0100 From: Imants Cekusins <ima...@gmail.com> To: The Haskell-Beginners Mailing List - Discussion of primarily beginner-level topics related to Haskell <beginners@haskell.org>, Olivier TOURNAIRE <olivier.tourna...@wanadoo.fr> Subject: Re: [Haskell-beginners] (no subject) Message-ID: <CAP1qinZsAzinMHgmDYPRLy1gutEQkSczHX9NefzQhOEMiJ4h=q...@mail.gmail.com> Content-Type: text/plain; charset="utf-8" > Haskell with a samsung tablet SM T800. The short answer: this is not easy. Here is some detail: https://wiki.haskell.org/Android -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.haskell.org/pipermail/beginners/attachments/20151108/2c50b3f8/attachment-0001.html> ------------------------------ Subject: Digest Footer _______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners ------------------------------ End of Beginners Digest, Vol 89, Issue 11 *****************************************