package pkcs11-driver
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=db6bed28e4a75cb3787d0b6feca954a91c9e52e678b8cc73c1058975b1846946
sha512=f764b356cac3dd7718003a158f2a4dad7b8caae981930ab9cfa674a08ebcf3583c531bfcca9ddbb593d0c8e5a64b52381f8c9c702c3a0d0d44000727b095c47a
doc/pkcs11-driver/Ctypes_helpers/index.html
Module Ctypes_helpersSource
Pointers with a GC link from the structure they are in. These are like Ctypes.ptr except that setf will add a link (through a finalizer) from the structure to the pointer to prevent its early collection.
ptr_from_string s allocates memory for a C string with length String.length s and content copied from s. The string is not null terminated.
string_from_ptr allocates an OCaml string.
string_from_carray array allocates a fresh OCaml string whose content are copied from array.
carray_from_string allocates a fresh array, whose content is identical to the string s. The resulting C string is not null terminated.
string_copy str length ptr copy the content of str into the length bytes of memory pointed to by ptr.
val make_string :
string ->
'a Ctypes.structure ->
(Unsigned.ULong.t, 'a Ctypes.structure) Ctypes.field ->
('b Reachable_ptr.t, 'a Ctypes.structure) Ctypes.field ->
unit* Copy an OCaml string to a Ctypes struct. * * Parameters: * - str is the source string * - p is the structure * - lengthField is the field within that struct that holds then length * - dataField idem for data * - typ is the type of the data
val view_string :
'b Ctypes.structure ->
(ulong, 'b Ctypes.structure) Ctypes.field ->
('a Reachable_ptr.t, 'b Ctypes.structure) Ctypes.field ->
string* Read an OCaml string from a Ctypes struct. * * Parameters: same as make_string.
val make_string_option :
string option ->
('a, [ `Struct ]) Ctypes.structured ->
(Unsigned.ULong.t, ('a, [ `Struct ]) Ctypes.structured) Ctypes.field ->
('b Reachable_ptr.t, ('a, [ `Struct ]) Ctypes.structured) Ctypes.field ->
unit* Copy a string option to a pointer + length. * Copying None sets the pointer to NULL and length to 0. * Parameters are the same as make_string.
val view_string_option :
('a, [ `Struct ]) Ctypes.structured ->
(ulong, 'a Ctypes.structure) Ctypes.field ->
('b Reachable_ptr.t, ('a, [ `Struct ]) Ctypes.structured) Ctypes.field ->
string option* Make a string option out of a pointer + length. * Same semantics for copy as make_string_option. * Same arguments as view_string.
Pad a string with ' ' up to length. Raises Buffer_overflow if the string is too long.
val packed_field :
't Ctypes.typ ->
string ->
'a Ctypes.typ ->
('a, ('s, [< `Struct | `Union ]) Ctypes_static.structured as 't) Ctypes.fieldLike Ctypes.field except that it will always align to 1 byte.
val smart_field :
't Ctypes.typ ->
string ->
'a Ctypes.typ ->
('a, ('s, [< `Struct | `Union ]) Ctypes_static.structured as 't) Ctypes.fieldOn unix, act like Ctypes.field. On windows, act like packed_field.
Open a file for writing and returns a formatter to it.