Created
January 31, 2012 13:55
-
-
Save saranyan/1710607 to your computer and use it in GitHub Desktop.
Testing Ruby FFI - C side
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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