English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
Accessing constructors (tags) from C
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2008-11-23 (18:22)
From: Raj Bandyopadhyay <rajb@r...>
Subject: Accessing constructors (tags) from C
Hi all

I was wondering how to access constructors from C. For example if I 
define a type

type t = Null | Int of int

and I want to create values of type t in C using the OCaml-C interface, 
how do I find
the integers corresponding to constructors Null or Int? I would like to 
do this for a large OCaml program with lots of different types etc.

Thanks!
Raj