Giter Club home page Giter Club logo

ffi-inliner's People

Contributors

crux avatar rdp avatar tylerc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

ffi-inliner's Issues

a failure is cached

Currently with this code:

module MyCLib
  extend Inliner
  inline do |builder|
    builder.library 'Winmm2'
    builder.c 'int func_1() { return 0; }'
  end
end

If you run it the first time it fails (there is no Winmm2 library).
Removing the offending line and running it again and it still fails, though in reality it should recompile and succeed.

no rake spec task in 1.8 windows

It doesn't appear as an option for some reason...I'd be happy to refactor the rakefile to use jeweler if that would help the situation.
-r

TCC generated shared libraries do not work in Windows

When using TCC as compiler for TCC, I found that symbols do not get exported automatically.

Symbols needs to be exported so FFI can find them:

ruby 1.8.6 (2009-08-04 patchlevel 383) [i386-mingw32]
C:/Users/Luis/.gem/ruby/1.8/gems/ffi-inliner-0.2.2/lib/ffi-inliner/inliner.rb:141:in `build': C:/Users/Luis/.gem/ruby/1.8/gems/ffi-0.5.1-x86-mingw32/lib/ffi/library.rb:77:in `attach_function': Function 'say_hello' not found in [C:/Users/Luis/.ffi-inliner/MyLib_92ce.dll] (FFI::NotFoundError)
        from (eval):4:in `build'
        from C:/Users/Luis/.gem/ruby/1.8/gems/ffi-inliner-0.2.2/lib/ffi-inliner/inliner.rb:248:in `inline'
        from inliner-test.rb:7

Since TCC do not offer a two step compiler linker process, the option is use -rdynamic parameter which is going to export all the symbols defined as inlined functions.

Thank you

requires fileutils?

## C:/installs/ruby-1.9.1-p243-tweaked/lib/ruby/gems/1.9.1/gems/sane-0.11.0/lib/sane/hash_set_operators_bug_fix.rb:4: warning: method redefined; discarding old

```
    # uninitialized constant Inliner::FileUtils
```

C:/installs/ruby-1.9.1-p243-tweaked/lib/ruby/gems/1.9.1/gems/ffi-inliner-0.2.2/lib/ffi-inliner/inliner.rb:254:in `__inliner_make_directory'

GPlusPlus still broken for windows

With 1.8.6 and 1.9.x, mingw, the gplusplus example yields:

C:\dev\digitalarchive_trunk>ruby -v go_ffi.rb
ruby 1.8.6 (2010-02-04 patchlevel 398) [i386-mingw32]
C:/installs/ruby-1.8.6-p388-i386-mingw32/lib/ruby/gems/1.8/gems/ffi-inliner-0.2.3/lib/ffi-inliner/inliner.rb:76:in `compile': Compile error! See C:/Users/packrd/.ffi-inliner/Foo_e888.log (RuntimeError)
        from C:/installs/ruby-1.8.6-p388-i386-mingw32/lib/ruby/gems/1.8/gems/ffi-inliner-0.2.3/lib/ffi-inliner/inliner.rb:174:in `build'
        from C:/installs/ruby-1.8.6-p388-i386-mingw32/lib/ruby/gems/1.8/gems/ffi-inliner-0.2.3/lib/ffi-inliner/inliner.rb:291:in `inline'
        from go_ffi.rb:5

C:\dev\digitalarchive_trunk>ruby -v go_ffi.rb
ruby 1.8.6 (2010-02-04 patchlevel 398) [i386-mingw32]
C:/installs/ruby-1.8.6-p388-i386-mingw32/lib/ruby/gems/1.8/gems/ffi-inliner-0.2.3/lib/ffi-inliner/inliner.rb:177:in `build': C:/installs/ruby-1.8.6-p388-i386-mingw32/lib/ruby/gems/1.8/ge (LoadError)-x86-mingw32/lib/ffi/library.rb:61:in `ffi_lib': Could not open library 'C:/Users/packrd/.ffi-inliner/Foo_e888.dll': The specified module could not be found.
        from C:/installs/ruby-1.8.6-p388-i386-mingw32/lib/ruby/gems/1.8/gems/ffi-0.6.3-x86-mingw32/lib/ffi/library.rb:43:in `map'
        from C:/installs/ruby-1.8.6-p388-i386-mingw32/lib/ruby/gems/1.8/gems/ffi-0.6.3-x86-mingw32/lib/ffi/library.rb:43:in `ffi_lib'
        from (eval):2:in `build'
        from C:/installs/ruby-1.8.6-p388-i386-mingw32/lib/ruby/gems/1.8/gems/ffi-inliner-0.2.3/lib/ffi-inliner/inliner.rb:291:in `inline'
        from go_ffi.rb:5

Not sure exaclty why.

C:\dev\digitalarchive_trunk>cat  C:/Users/packrd/.ffi-inliner/Foo_e888.log
Access is denied.

Hmm.

unable to run GPlusPlus examples from the gem

c:/ruby18/lib/ruby/gems/1.8/gems/sane-0.9.4/lib/sane/hash_set_operators_bug_fix.rb:4: warning: method redefined; discarding old -

```
    # uninitialized constant Inliner::Compilers::GPlusPlus
```

test2.rb:6
        builder.use_compiler Inliner::Compilers::GPlusPlus
c:/ruby18/lib/ruby/gems/1.8/gems/ffi-inliner-0.2.2/lib/ffi-inliner/inliner.rb:247:in `inline'
        yield builder if block_given?
test2.rb:5

Implement FFI::Struct marshalling

class MyStruct < FFI::Struct
  layout :a, :int, :b, :int
end

inline do |builder|
  builder.struct MyStruct
  builder.c %q{
    void inspect_my_struct(my_struct_t *my_struct)
    { 
      printf("a: %d b: %d", my_struct->a, my_struct->b");
    } 
  }
end

needs to specify appropriate bones version

perhaps I'm just clueless here, but installing the bones gem seems to need a specific version, perhaps?

(in C:/dev/ruby/ffi-inliner)
C:/installs/ruby-1.8.6-p388-i386-mingw32/lib/ruby/gems/1.8/gems/loquacious-1.6.4/lib/loquacious/undefined.rb:87: warning: parenthesize argument(s) for future version
rake aborted!
undefined method `setup' for Bones:Module
C:/installs/ruby-1.8.6-p388-i386-mingw32/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2383:in `raw_load_rakefile'
(See full trace by running task with --trace)

map C line numbers to their ruby equivalent

Currently when a C file fails, the log file generated shows error line numbers based on the C file, which don't map easily to the ruby file they came with.
This is a feature request to map them a bit closer.

I believe the pre processor macro desired is something like

#2 "C:/Users/packrd/.ffi-inliner/MyCLib_f925.rb" 2

Though I've never used it before...

parse failure

module MyCLib
  extend Inliner
  inline do |builder|
    builder.c <<-CODE
    int func_1() { return 0; }
    CODE
  end
end

fails to parse for some reason.

module MyCLib
  extend Inliner
  inline do |builder|
    builder.c <<-CODE
    int func_1() { 
       return 0; }
    CODE
  end
end

works though.

dependencies.rb:239:in `require': no such file to load -- ffi/inliner (LoadError)

I tried install gem 'tesseract-ocr', I added 'tesseract-ocr' to Gemfile and ran 'bundle update' with succesful.
When I trying run 'rails console' I have an error as below:

/usr/local/rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:239:in require': no such file to load -- ffi/inliner (LoadError) from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:239:inblock in require'
from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:225:in block in load_dependency' from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:596:innew_constants_in'
from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:225:in load_dependency' from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:239:inrequire'
from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/tesseract-ocr-0.1.1/lib/tesseract/c.rb:27:in <top (required)>' from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:239:inrequire'
from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:239:in block in require' from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:225:inblock in load_dependency'
from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:596:in new_constants_in' from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:225:inload_dependency'
from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:239:in require' from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/tesseract-ocr-0.1.1/lib/tesseract/api.rb:26:in<top (required)>'
from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:239:in require' from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:239:inblock in require'
from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:225:in block in load_dependency' from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:596:innew_constants_in'
from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:225:in load_dependency' from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:239:inrequire'
from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/tesseract-ocr-0.1.1/lib/tesseract-ocr.rb:25:in <top (required)>' from /usr/local/rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:inrequire'
from /usr/local/rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in block (2 levels) in require' from /usr/local/rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:ineach'
from /usr/local/rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:in block in require' from /usr/local/rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:ineach'
from /usr/local/rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:in require' from /usr/local/rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21/lib/bundler.rb:122:inrequire'
from /opt/rails_apps/intranet/config/application.rb:7:in <top (required)>' from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.9/lib/rails/commands.rb:21:inrequire'
from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.9/lib/rails/commands.rb:21:in <top (required)>' from script/rails:6:inrequire'
from script/rails:6:in `

'

What is wrong? I tried run on Windows 7 and Centos 6 - error is the same.

warning

C:/installs/ruby-1.8.6-p388-i386-mingw32/lib/ruby/gems/1.8/gems/ffi-inliner-0.2.3/lib/ffi-inliner/inliner.rb:170: warning: instance variable @libraries not initialized

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.