Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/remogatto/ffi-inliner
Mix C in (J)Ruby and gulp it on the fly!
https://github.com/remogatto/ffi-inliner
Last synced: 2 months ago
JSON representation
Mix C in (J)Ruby and gulp it on the fly!
- Host: GitHub
- URL: https://github.com/remogatto/ffi-inliner
- Owner: remogatto
- Created: 2009-07-07T20:46:01.000Z (over 15 years ago)
- Default Branch: master
- Last Pushed: 2013-05-30T11:27:41.000Z (over 11 years ago)
- Last Synced: 2024-10-31T13:55:19.104Z (2 months ago)
- Language: Ruby
- Homepage:
- Size: 1.24 MB
- Stars: 38
- Watchers: 5
- Forks: 6
- Open Issues: 5
-
Metadata Files:
- Readme: README.rdoc
- Changelog: History.txt
Awesome Lists containing this project
README
ffi-inliner
by Andrea Fazzi
http://github.com/remogatto/ffi-inliner== DESCRIPTION:
With ffi-inliner you can run C code within your ruby script.
== FEATURES/PROBLEMS:
* Mix C snippets in your Ruby code and gulp it on the fly!
* It's based on Ruby-FFI so the C code you inject is portable across
Ruby implementations!
* Yep, it means that you can run it on JRuby too!
* Fast compilation through tcc[http://bellard.org/tcc/]
* But it can use the system's compiler (e.g. gcc) on those platforms
that don't support tcc (e.g. OSX) or that don't have it installed== SYNOPSIS:
require 'ffi-inliner'
module MyLib
extend Inliner
inline 'void say_hello(char* name) { printf("Hello, %s\n", name); }'
endMyLib.say_hello('boys')
class Foo
include MyLib
endFoo.new.say_hello('foos')
For other hints see the examples/ folder or visit the
wiki[http://wiki.github.com/remogatto/ffi-inliner/tutorial]. For a
"real" world example you may be interested to
ffi-life[http://github.com/remogatto/ffi-life].== REQUIREMENTS:
* ffi >= 0.4.0
* gcc and/or tcc >= 0.9.25 (optional)== DOWNLOAD/INSTALL:
From rubyforge:
[sudo] gem install ffi-inliner
or from github:
git clone git://github.com/remogatto/ffi-inliner
cd ffi-inliner
sudo rake gem:install== CREDITS
Special thanks to:
* Ryan Davis for his inspiring
RubyInline[http://www.zenspider.com/ZSS/Products/RubyInline/].* Roger Pack for improving support for Windows platforms.
== LICENSE:
(The MIT License)
Copyright (c) 2009 Andrea Fazzi
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.