DLX / Ruby Dynamic Loader eXtended

The Elegant Interface Between Ruby & C

Search

Latest news

Dec 11: andreas09 is built with valid XHTML 1.1 and CSS2. It is simple and easy to work with, and it comes in several different flavors. This is version 1.0 (Dec 11th 2005).

Dec 10: Place for news or important messages, maybe?

Links:

2Types

To interface Ruby and C it is necessary to have a ruby object for each variable that may exist in C. C allows variables to have several different types, all of which are covered by DLX. You can divide these types into two groups of types: simple types and composite types.

This chapter will describe how to interface ruby to C with both groups of types using DLX. It will be concluded by discussing the notion of type closures, what they are and why they are important for DLX to operate so elegantly.

2.1simple types

2.1.1direct types

2.1.2pointer types

2.2composite types

2.2.1structs

11
22
10.times {
33
    puts( "HelloWorld" )
44
}
55
10.times {
66
    puts( "HelloWorld" )
77
}
88
10.times {
99
    puts( "HelloWorld" )
1010
}
1111
typedef struct Foo
1212
{
1313
    int a;
1414
    char* c;
1515
} Foo*;
1616
1717
void* b = (struct Foo*)malloc( sizeof( struct Foo ) );
1818
        

Lorem ipsum dolor sit amet, consectetaur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetaur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetaur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit

11
22
10.times {
33
    puts( "HelloWorld" )
44
}
55
10.times {
66
    puts( "HelloWorld" )
77
}
88
        

deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetaur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,

2.2.2unions

2.2.3pointer types

structs

arrays

Warning, this feature is not implemented yet, however the description given here will be its intended interface.

2.3type closures

2.3.1Forward Declarations