Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] Using -dtypes output in conjunction with a preprocessor
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2003-08-22 (07:32)
From: art yerkes <ayerkes@s...>
Subject: [Caml-list] Using -dtypes output in conjunction with a preprocessor
While I know it's not really intended for this, I've been giving some thought
to streamlining SWIG's Ocaml support.  To this end, I notice that -dtypes
has been added to ocamlc in order to support type browsing in emacs.

What I'm interested in finding out is if this output is expected to be stable,
or if there is another way to get this sort of deep type information from a
source file.  I intend to use this information as hints to a camlp4 module
that will recognize and rewrite references to C++ externals in order to emulate
C++ style overloading.  

As far as I can see, I will need the ocaml compiler to tell me what type is
expected for a certain application, then insert marshalling code that produces
and consumes the types indicated in the hint.

For example, I might produce:

let _ = print_endline 
    (get_int (__swig__wrapped_foo (C_list [(C_int a) (C_int b)]))


let _ = print_endline (string_of_int (foo 1 2))

Given that the detected type of foo will be "int -> int -> int"

Is using the -dtypes output the best way to get the right info?
"Should array indices start at 0 or 1? My compromise of 0.5 was rejected
 without, I thought, proper consideration."
   - S. Kelly-Bootle

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: