Created
February 8, 2018 13:46
-
-
Save rsnemmen/5f625effc3d62941e8d3b950d0f45e2f to your computer and use it in GitHub Desktop.
Example C function for interfacing with SWIG
This file contains hidden or 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
| /* | |
| File : example.c | |
| Obtained from http://www.swig.org/tutorial.html | |
| */ | |
| #include <time.h> | |
| double My_variable = 3.0; | |
| int fact(int n) { | |
| if (n <= 1) return 1; | |
| else return n*fact(n-1); | |
| } | |
| int my_mod(int x, int y) { | |
| return (x%y); | |
| } | |
| char *get_time() | |
| { | |
| time_t ltime; | |
| time(<ime); | |
| return ctime(<ime); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment