[MacRuby-devel] Using an SQLite wrapper with macruby
Matt Aimonetti
mattaimonetti at gmail.com
Wed Jan 5 12:53:33 PST 2011
I also documented the process there:
http://ofps.oreilly.com/titles/9781449380373/ch03.html#_using_objective_c_or_c_code
- Matt
Sent from my iPhone
On Jan 5, 2011, at 21:31, Laurent Sansonetti <lsansonetti at apple.com> wrote:
> Hi Ruben,
>
> MacRuby cannot call vararg functions without proper BridgeSupport metadata, because there is no way it can determine at runtime if a function is variadic or not (because the call site must be compiled differently).
>
> You may need to generate a BridgeSupport file for the wrapper you use. See the gen_bridge_metadata(1) man page for more info.
>
> If the wrapper is a framework, you just copy the file in the Resources/BridgeSupport directory (as documented in the man page), then calling #framework from MacRuby will automatically parse it for you.
>
> If the wrapper is a library that you link statically with your app, you will have to ship the BridgeSupport file in your app bundle, then use the #load_bridge_support_file method from the MacRuby side to load it up.
>
> Laurent
>
> On Jan 5, 2011, at 10:29 AM, Ruben Fonseca wrote:
>
>> Hi all.
>>
>> I'm trying to build a MacRuby 0.8 app with XCode. I want to interact with
>> an exisitng Sqlite3 database. Since I don't want to package or mess with
>> any Rubygem, I decided to look into existing Objective-C Sqlite wrappers.
>>
>> I've tried PLDatabase and fmdb, and failed with both. The code compiles and
>> the application runs, but when calling a C function what accepts a va_arg
>> argument list, my app receives a EXC_BAD_INSTRUCTION.
>>
>> Example:
>>
>> Objective-C function interface:
>>
>> - (FMResultSet *)executeQuery:(NSString*)sql, ... {
>>
>> Ruby code
>>
>> db.executeQuery "SELECT * FROM call"
>>
>> it receives the error on this C line inside the executeQuery function
>>
>> va_start(args, sql);
>>
>>
>> Any hints? Do you recommend a simple way of interacting with a Sqlite3
>> app with macruby + xcode, without using any gems?
>>
>> Thank you
>> Ruben
>> _______________________________________________
>> MacRuby-devel mailing list
>> MacRuby-devel at lists.macosforge.org
>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
> _______________________________________________
> MacRuby-devel mailing list
> MacRuby-devel at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20110105/d26adb4d/attachment.html>
More information about the MacRuby-devel
mailing list