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] Printf: export of format_int et al.
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Christian Lindig <lindig@c...>
Subject: [Caml-list] Printf: export of format_int et al.

We have code that uses some of the external functions like format_int 
and format_float.

external format_int: string -> int -> string = "caml_format_int"

Now that OCaml 3.08 has prefixed all C names with "caml_" (eg. 
"caml_format_int" instead of "format_int") it is more difficult to 
write code that compiles with old and new OCaml versions. It would be 
of great help if future OCaml versions would export these C functions 
as (stable) Caml values such that we could use these rather than the 
external values directly.

For example, format_int is defined in the Printf implementation, but 
not exported in the interface. Hashtbl gets it right, because 
"caml_hash_univ_param" is exported as Hashtbl.hash_param in the 
interface. Therefore we can use hash_param rather than 

external hash_param : int -> int -> 'a -> int = "caml_hash_univ_param" 

Maybe a new module "Externals" to centralize all these exports would be 
a solution if we don't want to touch the existing interfaces.

-- Christian

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