Module S.Untyped
Contents
Instructions: Use this module in your project
In the IDE (CLion, Visual Studio Code, Xcode, etc.) you use for your DkSDK project:
Add the following to your project's
dependencies/CMakeLists.txt
:DkSDKProject_DeclareAvailable(capnp CONSTRAINT "= 3.5.0" FINDLIBS capnp capnp.unix) DkSDKProject_MakeAvailable(capnp)
Add the
Findlib::capnp
library to any desired targets insrc/*/CMakeLists.txt
:target_link_libraries(YourPackage_YourLibraryName # ... existing libraries, if any ... Findlib::capnp)
Click your IDE's
Build
button
Not using DkSDK?
FIRST, do one or all of the following:
Run:
opam install capnp.3.5.0
Edit your
dune-project
and add:(package (name YourExistingPackage) (depends ; ... existing dependenices ... (capnp (>= 3.5.0))))
Then run:
dune build *.opam # if this fails, run: dune build
Edit your
<package>.opam
file and add:depends: [ # ... existing dependencies ... "capnp" {>= "3.5.0"} ]
Then run:
opam install . --deps-only
FINALLY, add the capnp
library to any desired (library)
and/or (executable)
targets in your **/dune
files:
(library
(name YourLibrary)
; ... existing library options ...
(libraries
; ... existing libraries ...
capnp))
(executable
(name YourExecutable)
; ... existing executable options ...
(libraries
; ... existing libraries ...
capnp))
type
abstract_method_t
An untyped method. This will typically be something like
'a reader_t -> 'b StructRef.t
. i.e. the result of calling an
interface's method is a promise for the future result.
val
abstract_method : ``(
'a
StructStorage.reader_t
,
'b
)``
Service.method_t
->
abstract_method_t
Cast a method to abstract_method_t
. Typically this will be the
identity function. This is used in the generated code to ensure that all
methods have the same type for the dispatch function.
val
struct_field :
'a
StructRef.t
->
``int
->
'b
StructRef.t
struct_field t i
is a reference to the struct found at pointer index
i
within the struct t
. Used to implement the "_pipelined"
accessors.
val
capability_field :
'a
StructRef.t
->
``int
->
'b
Capability.t
capability_field t i
is a reference to the capability found at pointer
index i
within the struct t
. Used to implement the "_pipelined"
accessors.
class
type
generic_service
=
object
...
end
val
local :
generic_service
->
'a
Capability.t
local service
is a capability reference to a local service implemented
by service#dispatch
. Used by the generated functions with the same
name (but a fixed type).
val
get_cap :
MessageSig.attachments
->
Uint32.t
->
'a
Capability.t
Used in the generated code to get a capability from the attachments by index.
val
add_cap :
MessageSig.attachments
->
'a
Capability.t
->
Uint32.t
Used in the generated code to store a capability in the attachments. Returns the new index.
val
clear_cap :
MessageSig.attachments
->
Uint32.t
->
unit
Remove a capability from the attachments. Used if the interface is changed.
val
unknown_interface : ``interface_id:
Uint64.t
->
abstract_method_t
Used to handle calls when the interface ID isn't known.
val
unknown_method : ``interface_id:
Uint64.t
->
``method_id:int
->
abstract_method_t
Used to handle calls when the method ID isn't known.