Skip to content

Instantly share code, notes, and snippets.

@saranyan
Created January 31, 2012 13:55
Show Gist options
  • Save saranyan/1710607 to your computer and use it in GitHub Desktop.
Save saranyan/1710607 to your computer and use it in GitHub Desktop.
Testing Ruby FFI - C side
#include "mylibrary.h"
#include <stdio.h>
double calculate_something(int a, float b)
{
return a+b;
}
const char* test_function_1(const char *w)
{
return w;
}
int test_function_2(double w,double *x, char *y) {
return ((int) w + (int) *x);
}
void test_function_3(){
printf("printing...x\n");
}
void test_function_4(double *x){
x[0] = 1.0;
x[1] = 2.0;
x[3] = 3.0;
}
/* mylibrary.h */
#define TESTVAR 2
double calculate_something(int a, float b);
const char* test_function_1(const char *w);
int test_function_2(double w, double *x, char *y);
void test_function_3();
void test_function_4(double *w);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment