$ ruby extconf.rb # to create the Makefile $ make # to build the library 'dl.so' $ make libtest.so # to build the C library 'libtest.so' for the test script $ make test # to run the test script $ make install # to install the library $ make clean # to remove the created files without Makefile $ make distclean # to remove the all created files
C : a character (char)the cbtype consists of type specifiers 0, I, L, D and P.
c : a pointer to a character (char *)
H : a short integer (short)
h : a pointer to a short integer (short *)
I : an integer (char, short, int)
i : a pointer to an integer (char *, short *, int *)
L : a long integer (long)
l : a pointer to a long integer (long *)
F : a real (float)
f : a pointer to a real (float *)
D : a real (double)
d : a pointer to a real (double *)
S : an immutable string (const char *)
s : a mutable string (char *)
A : an array (const type[])
a : a mutable array (type[])
P : a pointer (void *)
p : a mutable object (void *)
0 : void function (this must be a first character of the prototype)
DL.set_callback('IPP',0){|ptr1,ptr2| str1 = ptr1.ptr.to_s str2 = ptr2.ptr.to_s return str1 <=> str2 }