Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 59 lines (49 sloc) 2.345 kb
c3197d1 A few more docs
Evan Phoenix authored
1 /* A simple C++ wrapper around libffi. */
2
fceff3d NativeFunction, Selector, SendSite
Evan Phoenix authored
3 #include <stdio.h>
4 #include <stdlib.h>
5 #include <stdint.h>
6 #include <unistd.h>
7 #include <sys/stat.h>
e41e81e @brixen More header file portability for Windows.
brixen authored
8
9 #include "config.h"
10
11 #ifndef RBX_WINDOWS
fceff3d NativeFunction, Selector, SendSite
Evan Phoenix authored
12 #include <dlfcn.h>
e41e81e @brixen More header file portability for Windows.
brixen authored
13 #endif
fceff3d NativeFunction, Selector, SendSite
Evan Phoenix authored
14
15 #include "vm.hpp"
3f497e0 @brixen Renamed some vm files to be consistent.
brixen authored
16 #include "object_memory.hpp"
fceff3d NativeFunction, Selector, SendSite
Evan Phoenix authored
17
6ac48bd Fixed a LOT of dependencies by stripping objects.hpp and prelude.hpp as ...
Ryan Davis authored
18 #include "builtin/array.hpp"
19 #include "builtin/class.hpp"
20 #include "builtin/fixnum.hpp"
a390c02 More dependency fixes
Ryan Davis authored
21 #include "builtin/float.hpp"
71fdc75 FFI API revamp, take 1.
Evan Phoenix authored
22 #include "builtin/ffi_pointer.hpp"
3f497e0 @brixen Renamed some vm files to be consistent.
brixen authored
23 #include "builtin/native_function.hpp"
6ac48bd Fixed a LOT of dependencies by stripping objects.hpp and prelude.hpp as ...
Ryan Davis authored
24 #include "builtin/string.hpp"
25 #include "builtin/symbol.hpp"
26
3a0e9a4 @rue Renamed vm/object.hpp to vm/object_utils.hpp. File/#include shuffling.
rue authored
27 #include "ffi_util.hpp"
9159d36 Remove message.hpp cruft
Evan Phoenix authored
28 #include "arguments.hpp"
fceff3d NativeFunction, Selector, SendSite
Evan Phoenix authored
29
380797f @evanphx API cleanup: move new_(class|module) out of VM
evanphx authored
30 #include "ontology.hpp"
31
fceff3d NativeFunction, Selector, SendSite
Evan Phoenix authored
32 namespace rubinius {
33
35a49f3 @evanphx Introduce State class as STATE
evanphx authored
34 void VM::init_ffi(STATE) {
53a0a09 @brixen Moved FFI under Rubinius.
brixen authored
35 GO(ffi).set(ontology::new_module(state, "FFI", G(rubinius)));
eee9e94 @dbussink Add handling for varargs in FFI
dbussink authored
36 Module* mod = G(ffi);
35a49f3 @evanphx Introduce State class as STATE
evanphx authored
37 mod->set_const(state, "TYPE_CHAR", Fixnum::from(RBX_FFI_TYPE_CHAR));
38 mod->set_const(state, "TYPE_UCHAR", Fixnum::from(RBX_FFI_TYPE_UCHAR));
39 mod->set_const(state, "TYPE_BOOL", Fixnum::from(RBX_FFI_TYPE_BOOL));
40 mod->set_const(state, "TYPE_SHORT", Fixnum::from(RBX_FFI_TYPE_SHORT));
41 mod->set_const(state, "TYPE_USHORT", Fixnum::from(RBX_FFI_TYPE_USHORT));
42 mod->set_const(state, "TYPE_INT", Fixnum::from(RBX_FFI_TYPE_INT));
43 mod->set_const(state, "TYPE_UINT", Fixnum::from(RBX_FFI_TYPE_UINT));
44 mod->set_const(state, "TYPE_LONG", Fixnum::from(RBX_FFI_TYPE_LONG));
45 mod->set_const(state, "TYPE_ULONG", Fixnum::from(RBX_FFI_TYPE_ULONG));
46 mod->set_const(state, "TYPE_LL", Fixnum::from(RBX_FFI_TYPE_LONG_LONG));
47 mod->set_const(state, "TYPE_ULL", Fixnum::from(RBX_FFI_TYPE_ULONG_LONG));
48 mod->set_const(state, "TYPE_FLOAT", Fixnum::from(RBX_FFI_TYPE_FLOAT));
49 mod->set_const(state, "TYPE_DOUBLE", Fixnum::from(RBX_FFI_TYPE_DOUBLE));
50 mod->set_const(state, "TYPE_PTR", Fixnum::from(RBX_FFI_TYPE_PTR));
51 mod->set_const(state, "TYPE_VOID", Fixnum::from(RBX_FFI_TYPE_VOID));
52 mod->set_const(state, "TYPE_STRING", Fixnum::from(RBX_FFI_TYPE_STRING));
53 mod->set_const(state, "TYPE_STRPTR", Fixnum::from(RBX_FFI_TYPE_STRPTR));
54 mod->set_const(state, "TYPE_CHARARR", Fixnum::from(RBX_FFI_TYPE_CHARARR));
51b52ed @dbussink Add FFI::Union
dbussink authored
55 mod->set_const(state, "TYPE_ENUM", Fixnum::from(RBX_FFI_TYPE_ENUM));
eee9e94 @dbussink Add handling for varargs in FFI
dbussink authored
56 mod->set_const(state, "TYPE_VARARGS", Fixnum::from(RBX_FFI_TYPE_VARARGS));
fceff3d NativeFunction, Selector, SendSite
Evan Phoenix authored
57 }
58 };
Something went wrong with that request. Please try again.