-
Notifications
You must be signed in to change notification settings - Fork 804
Closed
Description
Hi, atgreen
I just check out libffi from git and installed on debian/6.0 x686_32 OS.
When I compile my c program, it shows errors:
undefined reference to ffi_type_sint32
undefined reference to ffi_call
collect2: ld returned 1 exit status
And I check the ffi.h header, but not find where is ffi_type_sint32 defined?
The core code like bellow:
Hi, guys
I am newer to libffi.
Now, I run into a compile error on debian/6.0 x86 system which I installed libffi use ./configurate --prefix=/usr config.
My simple code is:
#include <stdio.h>
#include <ffi.h>
int func0() {
return 0;
}
int func1(int x) {
return x;
}
int func2(int x, int y) {
return x + y;
}
void *func_table[] = {
(void *) func0,
(void *) func1,
(void *) func2,
}
int main(int argc, const char **argv) {
int i;
// some checks
if (argc < 2) {
exit(1);
}
int params_count = atoi(argv[1]);
int params[2] = {0, 0};
for (i = 0; i < 2; ++i) {
if (scanf("%d", ¶ms[i]) != 1) {
exit(1);
}
}
// define libffi call
ffi_cif cif;
ffi_type *args[] = { &ffi_type_sint, &ffi_type_sint };
void *ptr_params[] = { ¶ms[0], ¶ms[1] };
if (ffi_prep_cif( &cif, FFI_DEFAULT_ABI, params_count, &ffi_type_sint, args) ==FFI_OK) {
// TODO
} else {
// TODO
}
return 0;
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels