Last active
August 29, 2015 14:05
-
-
Save zmughal/05649d63917fbf84e99a to your computer and use it in GitHub Desktop.
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
all: libtowel.so | |
perl towel.pl | |
-@#LD_PRELOAD="`pwd`/libtowel.so" perl towel.pl | |
libtowel.so: towel.c | |
$(CC) -shared -fPIC -o $@ $< | |
clean: | |
rm -Rf _Inline/ libtowel.so |
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
all: libtowel.dll | |
perl towel.pl | |
libtowel.dll: towel.o | |
-$(CC) -shared -Wl,--out-implib,libtowel.a -o libtowel.dll $< | |
-REM $(CC) -shared -o $@ $< | |
towel.o: towel.c | |
$(CC) -c $< -o $@ | |
clean: | |
-$(RM) libtowel.dll libtowel.a towel.o | |
-del /Q /S _Inline |
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
#include "towel.h" | |
int h2g2() { | |
return 42; | |
} |
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
#ifndef _HELLO_H | |
#define _HELLO_H | |
extern int h2g2(); | |
#endif /* _HELLO_H */ |
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
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use v5.16; | |
use File::chdir; | |
use Inline C => Config => | |
FORCE_BUILD => 1, | |
CLEAN_AFTER_BUILD => 0, | |
INC => "-I$CWD", | |
LIBS => "-L$CWD -ltowel", | |
ENABLE => AUTOWRAP =>; | |
use Inline C => 'DATA'; | |
say h2g2(); | |
__END__ | |
__C__ | |
extern int h2g2(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment