comparison ruby/rbdc/README.txt @ 17:739c40f35a6a

- update READMEs
author cslag
date Sat, 26 Mar 2016 22:32:59 +0100
parents 6493c9ed4b33
children 02a455de2b40
comparison
equal deleted inserted replaced
16:a40084782546 17:739c40f35a6a
1 dyncall ruby bindings 1 dyncall ruby bindings
2 Copyright 2007-2016 Tassilo Philipp 2 Copyright 2007-2016 Tassilo Philipp
3 3
4 4
5 BUILD/INSTALLATION 5 BUILD/INSTALLATION
6 ------------------ 6 ==================
7 7
8 1) The extension isn't built here, but its code along with dyncall's source is bundled 8 1) The extension isn't built here, but its code along with dyncall's source is bundled
9 in a .gem file to then be built and installed on the target platform. 9 in a .gem file to then be built and installed on the target platform.
10 So, you need dyncall's full source code to be included. Unfortunately, the .gemspec isn't 10 So, you need dyncall's full source code to be included. Unfortunately, the .gemspec isn't
11 flexible enough to pull from different paths, so building the .gem file requires dyncall 11 flexible enough to pull from different paths, so building the .gem file requires dyncall
12 to be found next to rbdc.c and extconf.rb. This means either copy dyncall's base directory 12 to be found next to rbdc.c and extconf.rb. This means either copy dyncall's base directory
13 do ./dyncall or create a symlink ./dyncall, that points to it. 13 do ./dyncall or create a symlink ./dyncall, that points to it.
14 14
15 2) Then, build this gem with: 15 2) Then, build this gem with:
16 gem build rbdc.gemspec 16
17 gem build rbdc.gemspec
17 18
18 3) On the target platform, install the gem with: 19 3) On the target platform, install the gem with:
19 gem install ../../../rbdc-*.gem 20
21 gem install rbdc-*.gem
20 22
21 23
22 API 24 API
23 --- 25 ===
24 26
25 l = Dyncall::ExtLib.new 27 l = Dyncall::ExtLib.new
26 l.load(libpath) 28 l.load(libpath)
27 l.syms_init(libpath) 29 l.syms_init(libpath)
28 l.syms_count 30 l.syms_count
30 l.exists?(:symbolname) 32 l.exists?(:symbolname)
31 l.call(:symbolname, sigstring, ...) 33 l.call(:symbolname, sigstring, ...)
32 34
33 35
34 SIGNATURE FORMAT 36 SIGNATURE FORMAT
35 ---------------- 37 ================
36 38
37 format: "xxxxx)y" 39 format: "xxxxx)y"
38 40
39 x is positional parameter-type charcode 41 x is positional parameter-type charcode, y is result-type charcode
40 42
41 'B' C++: bool <- Ruby: TrueClass, FalseClass, NilClass, Fixnum 43 SIG | FROM RUBY | C/C++ | TO RUBY
42 'c' C: char <- Ruby: Fixnum 44 ----+-----------------------------------------+--------------------+-----------------------------------
43 'C' C: unsigned char <- Ruby: Fixnum 45 'v' | | void | NilClass
44 's' C: short <- Ruby: Fixnum 46 'B' | TrueClass, FalseClass, NilClass, Fixnum | bool | TrueClass, FalseClass
45 'S' C: unsigned short <- Ruby: Fixnum 47 'c' | Fixnum | char | Fixnum
46 'i' C: int <- Ruby: Fixnum 48 'C' | Fixnum | unsigned char | Fixnum
47 'I' C: unsigned int <- Ruby: Fixnum 49 's' | Fixnum | short | Fixnum
48 'j' C: long <- Ruby: Fixnum 50 'S' | Fixnum | unsigned short | Fixnum
49 'J' C: unsigned long <- Ruby: Fixnum 51 'i' | Fixnum | int | Fixnum
50 'l' C: long long <- Ruby: Fixnum 52 'I' | Fixnum | unsigned int | Fixnum
51 'L' C: unsigned long long <- Ruby: Fixnum 53 'j' | Fixnum | long | Fixnum
52 'f' C: float <- Ruby: Float 54 'J' | Fixnum | unsigned long | Fixnum
53 'd' C: double <- Ruby: Float 55 'l' | Fixnum | long long | Fixnum
54 'p' C: void* <- Ruby: String (check if there are other pointer-convertible ruby types @@@) 56 'L' | Fixnum | unsigned long long | Fixnum
55 'Z' C: void* <- Ruby: String 57 'f' | Float | float | Float
56 58 'd' | Float | double | Float
57 y is result-type charcode 59 'p' | String (other ruby types? @@@) | void* | unsupported at the moment @@@
58 60 'Z' | String | void* | String
59 'v' C: void -> Ruby: NilClass
60 'B' C: bool -> Ruby: TrueClass, FalseClass
61 'c' C: char -> Ruby: Fixnum
62 'C' C: unsigned char -> Ruby: Fixnum
63 's' C: short -> Ruby: Fixnum
64 'S' C: unsigned short -> Ruby: Fixnum
65 'i' C: int -> Ruby: Fixnum
66 'I' C: unsigned int -> Ruby: Fixnum
67 'j' C: long -> Ruby: Fixnum
68 'J' C: unsigned long -> Ruby: Fixnum
69 'l' C: long long -> Ruby: Fixnum
70 'L' C: unsigned long long -> Ruby: Fixnum
71 'f' C: float -> Ruby: Float
72 'd' C: double -> Ruby: Float
73 'p' C: void* -> unsupported at the moment @@@
74 'Z' C: void* -> Ruby: String
75 61
76 62
77 -> Note that signature suffixes used to indicate calling 63 TODO
78 -> conventions, are not supported yet! @@@ 64 ====
79 65
66 - support signature suffixes used to indicate calling conventions, are not supported yet!
67 - C pointer -> ruby... array?
68 - callback support
69