Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
* Interfaçage C/CAML
@ 2000-08-10 16:05 Nicolas Joliot
  2000-08-10 17:14 ` Markus Mottl
  0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Joliot @ 2000-08-10 16:05 UTC (permalink / raw)
  To: caml-list

Je suis actuellement en train de travailler sur l'interfaçage pour CAML
de la bibliothèque ILOG CPLEX 6.5.

J'ai actuellement des problèmes lorsque j'invoque 2 de ces fonctions C
sous Caml, l'une me renvoyant un floatant, l'autre un tableau de
floatant.

Lorsqu'elles sont appelées séparément, je peux afficher les resulats
sans problème, mais lorsque les deux sont appelées successivement et que
j'essaye d'afficher le tableau de floatants, j'ai systématiquement un
"Bus Error".

Par contre, l'affichage du floatant simple ne pose pas de problème,
aussi je pense que l'erreur doit provenir de la façon dont j'ai
représenté le tableau de floatant dans le fichier interface .c :

- déclaration : CAMLlocal1(tableau_float)
- allocation : tableau_float=alloc(nb_element*2,Double_array_tag)
- Utilisation :Store_double_field(tableau_float,i,floatant_a_renvoyer)
_ retour sous CAML par CAMLreturn

La représentation de ce tableau de float de type value est-elle
correcte? Si oui, quel peut être l'explication de ce plantage
systématique? Si non, quel est la bonne représentation en type "value"
d'un tableau de floatant? ( qui est d'ailleurs assez mal expliquée sur
le manuel on-line de ocaml)

Par ailleurs, j'ai remarqué qu'un printf"%f" pour afficher les floatants
de ce tableau engendrait parfois un "Bus Error".


-----------------------------------------------------------
JOLIOT Nicolas.
IRISA-INRIA, Campus de Beaulieu, 35042 Rennes cedex, France
Tél: +33 (0) 2 99 84 71 00, Fax: +33 (0) 2 99 84 71 71
email : nicolas.joliot@irisa.fr
-----------------------------------------------------------



^ permalink raw reply	[flat|nested] 6+ messages in thread
* Re: Interfaçage C/CAML
@ 2000-08-14 17:35 David McClain
  0 siblings, 0 replies; 6+ messages in thread
From: David McClain @ 2000-08-14 17:35 UTC (permalink / raw)
  To: Markus Mottl, David Mentré; +Cc: Nicolas Joliot, caml-list

Many thanks for pointing this error out... I had inadvertantly used the
incorrect Store_... form twice on finalized structures in my bulk of code,
although I have never experienced any problems from it... But just to be
safe I read the message in the archives and went through by stuff to clean
it up...

- David

-----Original Message-----
From: David Mentré <David.Mentre@irisa.fr>
To: Markus Mottl <mottl@miss.wu-wien.ac.at>
Cc: Nicolas Joliot <Nicolas.Joliot@irisa.fr>; caml-list@inria.fr
<caml-list@inria.fr>
Date: Monday, August 14, 2000 9:49 AM
Subject: Re: Interfaçage C/CAML


>Markus Mottl <mottl@miss.wu-wien.ac.at> writes:
>
>> It seems that a common bug has struck again: using "Store_{whatever}" in
>> C-interfaces is only allowed (and then mandatory) with structured blocks.
>> Using it for anything else may crash the GC.
>
>I would say that Store_{whatever} macros are useful for data structures
>that are created in the C-world but should be managed (and destroyed) in
>the OCaml-world, WITHOUT any further access on the data by the C
>part. For all other cases, use the Field_{whatever} macros. With this
>macro, the OCaml GC won't try to have a look at your C data structures.
>
>By the way, Markus has already found a bug like this in my own code. See
>this message for further details on how the bug is triggered :
>  http://caml.inria.fr/archives/200002/msg00074.html
>
>I hope it helps,
>d.
>--
> David.Mentre@irisa.fr -- http://www.irisa.fr/prive/dmentre/
> Opinions expressed here are only mine.
>



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2000-08-16 14:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-08-10 16:05 Interfaçage C/CAML Nicolas Joliot
2000-08-10 17:14 ` Markus Mottl
2000-08-11  8:24   ` Xavier Leroy
2000-08-11 10:54     ` Markus Mottl
2000-08-11  8:58   ` David Mentré
2000-08-14 17:35 David McClain

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox