Projects

Ticket #178 (closed defect: fixed)

Opened 3 years ago

Last modified 21 months ago

ArgumentError Exception: can't convert C/Objective-C value of type `[4d]' to Ruby object

Reported by: dognotdog@… Owned by: lsansonetti@…
Priority: major Milestone: MacRuby 0.6
Component: MacRuby Keywords: ArgumentError array convert
Cc:

Description

Trying to use a function with the following .bridgesupport entry:

<function name='vCreate'>
<arg type='d'/>
<arg type='d'/>
<arg type='d'/>
<arg type='d'/>
<retval type='{_vt=[4d]}'/>
</function>

Function prototype:

typedef double vmfloat_t;
typedef struct _vt
{
    vmfloat_t farr[4];
} vector_t;
vector_t vCreate(vmfloat_t a, vmfloat_t b, vmfloat_t c, vmfloat_t d);

An ArgumentError exception is raised on the return type. It's simply a struct containing a simple array, so automatic boxing/unboxing should work. Possible fix through additions to the bridgesupport entry?

trunk/ r766

Attachments

ticket-178.diff Download (1.9 KB) - added by dognotdog@… 3 years ago.
Patch for #178 quickfix

Change History

Changed 3 years ago by dognotdog@…

Patch for #178 quickfix

Changed 3 years ago by dognotdog@…

The submitted patch seems to work for types as described above, though they stay opaque to MacRuby. It would be nice to have non-opaque bridging as well, for example by being able to supply values for methods taking {_vt=[4d]} as a parameter via a plain ruby array of the right size.

Changed 2 years ago by dognotdog@…

I just want to add that as of trunk r2709, this is still broken, and my previous patch also no longer works with 0.5, as the boxing code is completely different. Unfortunately, this is critical for me to get my project running on Snow Leopard.

Changed 21 months ago by lsansonetti@…

  • status changed from new to closed
  • resolution set to fixed
  • milestone set to MacRuby 0.6

This should be fixed in 0.6 (we added support for these encoding types). If it doesn't work for you still, please comment here.

Note: See TracTickets for help on using tickets.