Created
April 26, 2014 11:27
-
-
Save chomy/11317642 to your computer and use it in GitHub Desktop.
FFI test on CLISP
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
| /* | |
| gcc -fPIC -shared -o libnow.so now.c | |
| */ | |
| #include <time.h> | |
| #include <stdio.h> | |
| char* now() | |
| { | |
| time_t systime; | |
| struct tm tmtime; | |
| static char buff[64]; | |
| systime = time(NULL); | |
| localtime_r(&systime, &tmtime); | |
| strftime(buff, sizeof(buff), "%c", &tmtime); | |
| return buff; | |
| } |
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
| (use-package "FFI") | |
| (ffi:open-foreign-library "libnow.so") | |
| (ffi:def-call-out now (:LIBRARY "libnow.so") (:language :stdc) (:return-type ffi:c-string)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment