Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $headerName = 'stdio.h';
- $libName = 'libc.so';
- try {
- $libc = FFI::load($headerName);
- var_dump($libc);
- } catch(FFI\Exception $e)
- {
- fprintf(STDERR, '%s on line %s%s', $e->getMessage(),$e->getLine(), PHP_EOL);
- $headerContent = sprintf('#define FFI_LIB "%s"%s', $libName, PHP_EOL);
- $headerContent .= sprintf('#define FFI_SCOPE "_%s"%s', strtoupper($libName), PHP_EOL);
- if(file_put_contents($headerName, $headerContent)) {
- echo exec(sprintf('cpp -P -C -D"__attribute__(ARGS)="$(find $PREFIX -type f -name %s)>>%s', $headerName, $headerName));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement