C binding
You can create a C binding by instantiating the CGT::LibC
class (here abbreviated as CGT::LibC
)
and adding methods to it.
Output:
Included modules
Crygen::Modules::Annotation
Create a binding with a function
libc_type = Crygen::Types::LibC.new("C")
libc_type.add_function("getch", "Int32")
puts libc_type.generate
Output:
Create a binding with a struct
libc_type = Crygen::Types::LibC.new("C")
libc_type.add_struct("Person", [{"name", "String"}, {"age", "Int32"}])
puts libc_type.generate
Output:
Create a binding with a union
libc_type = Crygen::Types::LibC.new("C")
libc_type.add_union("IntOrFloat", [
{"some_int", "Int32"},
{"some_float", "Float64"}
])
puts libc_type.generate
Output: