Go to the first, previous, next, last section, table of contents.


The Dlopen module

type dll
  
type dloption = 
  RTLD_GLOBAL
| RTLD_LAZY
| RTLD_NOW  
  
exception DL_Error of string
  

val dlopen : string -> dloption list -> dll

val dlclose : dll -> unit

val dlsym : dll -> string -> ('c -> 'a,unit, 'c) format -> 'a

dlsym dll f_name f_types load the "f_name" function from the "dll" (opened by dlopen) and with type specified by the printf format string "f_types". In this string, the first part is the return type of the function, while other parts are the arguments:

"%d:%s%d%s" is the format for "string -> int -> string -> int"

type 'a meta

val float_t : float meta

val int_t : int meta

val char_t : char meta

val string_t : string meta

val ( @-> ) : 'a meta -> 'b meta -> ('a -> 'b) meta

val ( @* ) : 'a meta -> 'b meta -> ('a * 'b) meta

val star_t : 'a meta -> ('a option) meta

val mutable_t : 'a meta -> 'a ref meta

val record2_t : 'a meta * 'b meta -> ('a * 'b) meta

val record3_t : 'a meta * 'b meta * 'c meta -> ('a * 'b * 'c) meta

val record4_t : 'a meta * 'b meta * 'c meta * 'd meta -> ('a * 'b * 'c * 'd) meta

val record5_t : 'a meta * 'b meta * 'c meta * 'd meta * 'e meta -> ('a * 'b * 'b * 'c * 'd * 'e) meta

val record6_t : 'a meta * 'b meta * 'c meta * 'd meta * 'e meta * 'f meta -> ('a * 'b * 'c * 'd * 'e * 'f) meta
    

val dlsym_t : dll -> string -> 'a meta -> 'a

dlsym_t dll f_name f_types same as dlsym except that the type is given by type combinators. It allows to pass structs to C functions, and get side effects on them. See "test.ml" and "test.c" for examples to run in the toplevel...


Go to the first, previous, next, last section, table of contents.