| 1 |
root |
1.1 |
#include "cpjit.h" |
| 2 |
|
|
|
| 3 |
|
|
#include <iostream> |
| 4 |
|
|
|
| 5 |
|
|
using namespace cpjit; |
| 6 |
|
|
using namespace std; |
| 7 |
|
|
|
| 8 |
|
|
int main (void) |
| 9 |
|
|
{ |
| 10 |
root |
1.5 |
env e ("/tmp/libcpjit"); |
| 11 |
root |
1.1 |
|
| 12 |
root |
1.3 |
funbuild2<int, PTR, U64> fb (e); |
| 13 |
root |
1.2 |
fb << "return ((int *)a1)[0] + a2;"; |
| 14 |
root |
1.4 |
fun2<int, PTR, U64> &f = *fb.get (); |
| 15 |
root |
1.1 |
|
| 16 |
root |
1.5 |
funbuild2<int, PTR, U64> fb2 (e); |
| 17 |
|
|
fb2 << "return ((int *)a1)[0] - a2;"; |
| 18 |
|
|
fun2<int, PTR, U64> &f2 = *fb2.get (); |
| 19 |
|
|
|
| 20 |
root |
1.2 |
int i = 3; |
| 21 |
root |
1.5 |
cout << f (&i, 2) << endl; |
| 22 |
|
|
cout << f2 (&i, 2) << endl; |
| 23 |
root |
1.2 |
|
| 24 |
root |
1.1 |
return 0; |
| 25 |
|
|
} |