[MacRuby] #376: The second 'pointer' of a double pointer type is ignored
#376: The second 'pointer' of a double pointer type is ignored ---------------------------------+------------------------------------------ Reporter: mred@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: ---------------------------------+------------------------------------------ The following code worked in 0.4 {{{ framework 'Foundation' framework 'AudioToolbox' load_bridge_support_file '../BridgeSupport/MusicPlayer.bridgesupport' class MusicPlayer def initialize musicPlayer = Pointer.new_with_type '^{OpaqueMusicPlayer}' # This should create a double pointer puts musicPlayer.type # But it doesn't (result = NewMusicPlayer musicPlayer) == 0 or raise result.to_s @musicPlayer = musicPlayer[0] # Causing problems here end end musicPlayer = MusicPlayer.new }}} But it now generates the following error {{{ $ macruby x.rb ^{OpaqueMusicPlayer} x.rb:8:in `initialize': unrecognized runtime type `{OpaqueMusicPlayer}' (TypeError) from core:in `__new__:' from x.rb:1:in `<main>' }}} The error is occuring during the attempt to dereference the double pointer at line 10 (despite the error message reporting line 8) -- Ticket URL: <http://www.macruby.org/trac/ticket/376> MacRuby <http://macruby.org/>
#376: The second 'pointer' of a double pointer type is ignored ---------------------------------+------------------------------------------ Reporter: mred@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: ---------------------------------+------------------------------------------ Comment(by lsansonetti@…): This looks like a regression in trunk. We should cover this behavior in spec/macruby/core/pointer_spec.rb. -- Ticket URL: <http://www.macruby.org/trac/ticket/376#comment:1> MacRuby <http://macruby.org/>
#376: The second 'pointer' of a double pointer type is ignored ---------------------------------+------------------------------------------ Reporter: mred@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: ---------------------------------+------------------------------------------ Comment(by lsansonetti@…): Could you attach your MusicPlayer.bridgesupport file? I'm curous how ^{OpaqueMusicPlayer} is annotated. -- Ticket URL: <http://www.macruby.org/trac/ticket/376#comment:2> MacRuby <http://macruby.org/>
#376: The second 'pointer' of a double pointer type is ignored ---------------------------------+------------------------------------------ Reporter: mred@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: ---------------------------------+------------------------------------------ Comment(by martinlagardette@…): It's not that it's ignored. The thing is that `musicPlayer[0]` is a pointer to `{OpaqueMusicPlayer}`, but your bridgesupport file doesn't give any information on how `{OpaqueMusicPlayer}` is defined (it doesn't say either it's an opaque struct, or how the struct is defined). By the way, `type` not returning `^^` doesn't mean it's not a double pointer. By default, `type` returns the type it points to, just like the argument. I guess we should close this bug? -- Ticket URL: <http://www.macruby.org/trac/ticket/376#comment:3> MacRuby <http://macruby.org/>
#376: The second 'pointer' of a double pointer type is ignored ---------------------------------+------------------------------------------ Reporter: mred@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: ---------------------------------+------------------------------------------ Comment(by mred@…): I'm still unclear as to how one calls NewMusicPlayer in MacRuby. I just reran the test code under MacRuby 4215 and a freshly created bridge support file via {{{ gen_bridge_metadata -f /System/Library/Frameworks/AudioToolbox.framework -o AudioToolbox.bridgesupport }}} and got the same results. If gen_bridge_metadata doesn't generate the information on how {OpaqueMusicPlayer} is defined, then do I need manually add it to the bridgesupport file? If so, what text needs to be added so the pointer is properly recognized? -- Ticket URL: <http://www.macruby.org/trac/ticket/376#comment:4> MacRuby <http://macruby.org/>
#376: The second 'pointer' of a double pointer type is ignored ---------------------------------+------------------------------------------ Reporter: mred@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: ---------------------------------+------------------------------------------ Comment(by martinlagardette@…): What you can add in `MusicPlayer.bridgesupport` is information about music player being an opaque struct. Between structs and enums, I added the following line: {{{ #!xml <opaque name='OpaqueMusicPlayerRef' type='^{OpaqueMusicPlayer}'/> }}} Then when I run the script: {{{ $> macruby t.rb ^{OpaqueMusicPlayer} $> }}} -- Ticket URL: <http://www.macruby.org/trac/ticket/376#comment:5> MacRuby <http://macruby.org/>
Thanks Martin, that explains it. Ed On Jun 14, 2010, at 7:07 PM, MacRuby wrote:
#376: The second 'pointer' of a double pointer type is ignored ---------------------------------+------------------------------------------ Reporter: mred@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: ---------------------------------+------------------------------------------
Comment(by martinlagardette@…):
What you can add in `MusicPlayer.bridgesupport` is information about music player being an opaque struct. Between structs and enums, I added the following line: {{{ #!xml <opaque name='OpaqueMusicPlayerRef' type='^{OpaqueMusicPlayer}'/> }}}
Then when I run the script: {{{ $> macruby t.rb ^{OpaqueMusicPlayer} $> }}}
-- Ticket URL: <http://www.macruby.org/trac/ticket/376#comment:5> MacRuby <http://macruby.org/>
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
You are very welcome :-). I know it can be tricky, because one would tend to believe the bridgesupport files are all correct, but there is definitely a lot of area for improvement (which is being worked on ;-)) Can I close the bug, if everything is working? P.S.: My first name is actiually Thibault :P -- Thibault Martin-Lagardette On Jun 15, 2010, at 08:10, Ed wrote:
Thanks Martin, that explains it.
Ed
On Jun 14, 2010, at 7:07 PM, MacRuby wrote:
#376: The second 'pointer' of a double pointer type is ignored ---------------------------------+------------------------------------------ Reporter: mred@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: ---------------------------------+------------------------------------------
Comment(by martinlagardette@…):
What you can add in `MusicPlayer.bridgesupport` is information about music player being an opaque struct. Between structs and enums, I added the following line: {{{ #!xml <opaque name='OpaqueMusicPlayerRef' type='^{OpaqueMusicPlayer}'/> }}}
Then when I run the script: {{{ $> macruby t.rb ^{OpaqueMusicPlayer} $> }}}
-- Ticket URL: <http://www.macruby.org/trac/ticket/376#comment:5> MacRuby <http://macruby.org/>
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
Go ahead and close it out as everything's working fine now. The problem was due to bridgesupport ignorance on my part anyways. Ed P.S. Sorry about mangling you name, will get it right next time! On Jun 15, 2010, at 1:10 PM, Thibault Martin-Lagardette wrote:
You are very welcome :-).
I know it can be tricky, because one would tend to believe the bridgesupport files are all correct, but there is definitely a lot of area for improvement (which is being worked on ;-))
Can I close the bug, if everything is working?
P.S.: My first name is actiually Thibault :P
-- Thibault Martin-Lagardette
On Jun 15, 2010, at 08:10, Ed wrote:
Thanks Martin, that explains it.
Ed
On Jun 14, 2010, at 7:07 PM, MacRuby wrote:
#376: The second 'pointer' of a double pointer type is ignored ---------------------------------+------------------------------------------ Reporter: mred@… | Owner: lsansonetti@… Type: defect | Status: new Priority: blocker | Milestone: Component: MacRuby | Keywords: ---------------------------------+------------------------------------------
Comment(by martinlagardette@…):
What you can add in `MusicPlayer.bridgesupport` is information about music player being an opaque struct. Between structs and enums, I added the following line: {{{ #!xml <opaque name='OpaqueMusicPlayerRef' type='^{OpaqueMusicPlayer}'/> }}}
Then when I run the script: {{{ $> macruby t.rb ^{OpaqueMusicPlayer} $> }}}
-- Ticket URL: <http://www.macruby.org/trac/ticket/376#comment:5> MacRuby <http://macruby.org/>
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
#376: The second 'pointer' of a double pointer type is ignored ---------------------------------+------------------------------------------ Reporter: mred@… | Owner: lsansonetti@… Type: defect | Status: closed Priority: blocker | Milestone: Component: MacRuby | Resolution: invalid Keywords: | ---------------------------------+------------------------------------------ Changes (by martinlagardette@…): * status: new => closed * resolution: => invalid Comment: Closing as per discussion with reporter, this is a bug in the generated bridge support file, not MacRuby :-) -- Ticket URL: <http://www.macruby.org/trac/ticket/376#comment:6> MacRuby <http://macruby.org/>
participants (3)
-
Ed
-
MacRuby
-
Thibault Martin-Lagardette