[MacRuby-devel] Using an SQLite wrapper with macruby
Laurent Sansonetti
lsansonetti at apple.com
Wed Jan 5 12:31:02 PST 2011
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20110105/d73a45be/attachment-0001.html>
More information about the MacRuby-devel
mailing list