new

new(handlers) Class Public methods

[]

[](symbol) Instance Public methods

handlers

handlers() Instance Public methods

sym

sym(symbol) Instance Public methods

parse_ctype

parse_ctype(ty, tymap=nil) Instance Public methods Given a String of C type ty, return the corresponding DL constant. ty can also accept an Array of C type Strings, and will returned in a corresponding Array. If Hash tymap is provided, ty is expected to be the key, and the value will be the C type to be looked up. Example: parse_ctype('int') => DL::TYPE_INT parse_ctype('double') => DL::TYPE_DOUBLE parse_ctype('unsigned char') => -DL::TYPE_CHAR

parse_signature

parse_signature(signature, tymap=nil) Instance Public methods Parses a C prototype signature Example: include DL::CParser => Object parse_signature('double sum(double, double)') => ["sum", DL::TYPE_DOUBLE, [DL::TYPE_DOUBLE, DL::TYPE_DOUBLE]]

parse_struct_signature

parse_struct_signature(signature, tymap=nil) Instance Public methods Parses a C struct's members Example: parse_struct_signature(['int i', 'char c']) => [[DL::TYPE_INT, DL::TYPE_CHAR], ["i", "c"]]

entity_class

entity_class() Class Public methods accessor to DL::CStructEntity

create

create(klass, types, members) Class Public methods Construct a new class given a C: class klass (CUnion, CStruct, or other that provide an entity_class) types (DL:TYPE_INT, DL::TYPE_SIZE_T, etc., see the C types constants) corresponding members DL::Importer#struct and DL::Importer#union wrap this functionality in an easy-to-use manner. Example: require 'dl/struct' require 'dl/cparser' include DL::CParser types, members = parse_struct_signature(['int i','char c']) MyStruc

malloc

malloc(types, func = nil) Class Public methods Allocates a C struct the types provided. The C function func is called when the instance is garbage collected.