Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 56 lines (47 sloc) 2.238 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"
16 #include "objectmemory.hpp"
17
6ac48bd Fixed a LOT of dependencies by stripping objects.hpp and prelude.hpp …
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"
6ac48bd Fixed a LOT of dependencies by stripping objects.hpp and prelude.hpp …
Ryan Davis authored
23 #include "builtin/nativefunction.hpp"
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
30 namespace rubinius {
31
32 void VM::init_ffi() {
33 Module* mod = new_module("FFI");
4a7b116 @dbussink Refactor Bignum::create to Bignum::from and clean up to_ functions
dbussink authored
34 mod->set_const(this, "TYPE_OBJECT", Fixnum::from(RBX_FFI_TYPE_OBJECT));
35 mod->set_const(this, "TYPE_CHAR", Fixnum::from(RBX_FFI_TYPE_CHAR));
36 mod->set_const(this, "TYPE_UCHAR", Fixnum::from(RBX_FFI_TYPE_UCHAR));
fa33f96 Fix a few more FFI incompat issues
Evan Phoenix authored
37 mod->set_const(this, "TYPE_BOOL", Fixnum::from(RBX_FFI_TYPE_BOOL));
4a7b116 @dbussink Refactor Bignum::create to Bignum::from and clean up to_ functions
dbussink authored
38 mod->set_const(this, "TYPE_SHORT", Fixnum::from(RBX_FFI_TYPE_SHORT));
39 mod->set_const(this, "TYPE_USHORT", Fixnum::from(RBX_FFI_TYPE_USHORT));
40 mod->set_const(this, "TYPE_INT", Fixnum::from(RBX_FFI_TYPE_INT));
41 mod->set_const(this, "TYPE_UINT", Fixnum::from(RBX_FFI_TYPE_UINT));
42 mod->set_const(this, "TYPE_LONG", Fixnum::from(RBX_FFI_TYPE_LONG));
43 mod->set_const(this, "TYPE_ULONG", Fixnum::from(RBX_FFI_TYPE_ULONG));
b881222 Steamroller session getting the kernel running.
Evan Phoenix authored
44 mod->set_const(this, "TYPE_LL", Fixnum::from(RBX_FFI_TYPE_LONG_LONG));
45 mod->set_const(this, "TYPE_ULL", Fixnum::from(RBX_FFI_TYPE_ULONG_LONG));
4a7b116 @dbussink Refactor Bignum::create to Bignum::from and clean up to_ functions
dbussink authored
46 mod->set_const(this, "TYPE_FLOAT", Fixnum::from(RBX_FFI_TYPE_FLOAT));
47 mod->set_const(this, "TYPE_DOUBLE", Fixnum::from(RBX_FFI_TYPE_DOUBLE));
48 mod->set_const(this, "TYPE_PTR", Fixnum::from(RBX_FFI_TYPE_PTR));
49 mod->set_const(this, "TYPE_VOID", Fixnum::from(RBX_FFI_TYPE_VOID));
50 mod->set_const(this, "TYPE_STRING", Fixnum::from(RBX_FFI_TYPE_STRING));
51 mod->set_const(this, "TYPE_STATE", Fixnum::from(RBX_FFI_TYPE_STATE));
52 mod->set_const(this, "TYPE_STRPTR", Fixnum::from(RBX_FFI_TYPE_STRPTR));
53 mod->set_const(this, "TYPE_CHARARR", Fixnum::from(RBX_FFI_TYPE_CHARARR));
fceff3d NativeFunction, Selector, SendSite
Evan Phoenix authored
54 }
55 };
Something went wrong with that request. Please try again.