From: Eric Hodel Date: 2006-10-03T02:51:46+09:00 Subject: Re: Calling an existing method with RubyInline - how? On Sep 30, 2006, at 4:37 PM, Daniel Berger wrote: > On 9/30/06, Eric Hodel wrote: >> On Sep 29, 2006, at 9:49 PM, Daniel Berger wrote: >>> How do you call an existing function from an included header file >>> using RubyInline? Do I have to wrap it in a 'built' function? >> >> From your example, probably: >> >> require 'inline' >> >> class Foo >> inline do |builder| >> builder.include "" >> builder.add_compile_flags "-ltest" >> >> builder.c_singleton <<-EOF >> char * foo_test_version() { >> return test_version(); >> } >> EOF >> end >> >> class << self; alias version foo_test_version; end >> end > > > Thanks. Is there any way to avoid having to write wrappers for > existing functions? If not, could it be added as a feature? > > I'd like to be able to just do this: > > inline{ "return test_version();" } Inline doesn't have anything to read the header files to figure out the types... -- Eric Hodel - drbrain@segment7.net - http://blog.segment7.net This implementation is HODEL-HASH-9600 compliant http://trackmap.robotcoop.com