swig/Examples/test-suite/ocaml/struct_value_runme.ml
Zackery Spytz 4a912668fc [OCaml] Fix member var getters and setters
Add `membervariableHandler()` to the `OCAML` class in ocaml.cxx (it is
partly based on the code in python.cxx and octave.cxx).

In Lib/ocaml/class.swg, wrapped classes/structs were not being added
to `class_master_list`. This is fixed by adding a call to
`register_class_byname`.

Add a unit test in the form of struct_value_runme.ml.
2019-01-06 09:40:25 -07:00

11 lines
300 B
OCaml

open Swig
open Struct_value
let b = new_Bar (C_void)
let a = (invoke b) "[a]" (C_void)
let _ = (invoke a) "[x]" (C_int 3)
let _ = assert((invoke a) "[x]" (C_void) = C_int 3)
let bb = (invoke b) "[b]" (C_void)
let _ = (invoke bb) "[x]" (C_int 3)
let _ = assert((invoke bb) "[x]" (C_void) = C_int 3)