Ok, there’s really no reason I couldn’t use a reference in the meantime.
On the Javascript side is there anything special I need to do the “unwrap” the reference? -------------------------------------- Scott Watson c: 714-317-2100 e: wswat...@gmail.com > On Feb 15, 2018, at 11:20 AM, Alon Zakai <alonza...@gmail.com> wrote: > > I see, thanks. Yeah, looking into this some more, that does seem like > surprising behavior - I would also expect a pointer there, not the object > itself. Seems surprising we didn't notice it til now, but it appears bullet > and box2d use references in most of their APIs, not pointers. > > Moving forward, it's probably not worth changing the current behavior. We > could add a new attribute, "Ptr" perhaps, to parallel "Ref". > > On Wed, Feb 14, 2018 at 3:44 PM, Scott Watson <wswat...@gmail.com > <mailto:wswat...@gmail.com>> wrote: > Hi Alon, > > StatusInfo looks like this: > > [Prefix="Arris::"] > interface StatusInfo { > readonly attribute unsigned long bitrate; > readonly attribute unsigned long networkthroughput; > readonly attribute unsigned long optimalbitrate; > > readonly attribute unsigned long droppedframes; > readonly attribute unsigned long stalls; > > readonly attribute double decodeFPS; > readonly attribute double renderFPS; > > readonly attribute unsigned long audiosegments; > readonly attribute unsigned long videosegments; > readonly attribute unsigned long h264frames; > readonly attribute unsigned long rgbframes; > readonly attribute unsigned long pcmframes; > > readonly attribute double seconds; > readonly attribute double duration; > readonly attribute double cacheduration; > > readonly attribute PlayerState playerstate; > readonly attribute boolean frontendrunning; > readonly attribute boolean audiodemuxerrunning; > readonly attribute boolean videodemuxerrunning; > readonly attribute boolean decoderrunning; > readonly attribute boolean audiorendererrunning; > readonly attribute boolean videorendererrunning; > readonly attribute PlayerError lasterror; > }; > > > On Wednesday, February 14, 2018 at 3:34:47 PM UTC-8, Alon Zakai wrote: > How did you define StatusInfo in the idl file? > > On Tue, Feb 13, 2018 at 12:05 PM, Scott Watson <wswa...@gmail.com <>> wrote: > Hi folks, > > I'm trying to create a callback mechanism to call into JS from C++. I have a > pure virtual C++ class that defines the callback interface defined as: > > class MediaPlayerDelegate { > public: > virtual void PlayerStateChanged(PlayerState state, void *context)=0; > virtual void PlayerStatus(StatusInfo *status, void *context)=0; > virtual void PlayerErrorEncountered(PlayerError error, void *context)=0; > }; > > > > and I've described it in the IDL file as: > > [Prefix="Arris::", NoDelete] > callback interface MediaPlayerDelegate { > void PlayerStateChanged(PlayerState state, any context); > void PlayerStatus(StatusInfo status, any context); > void PlayerErrorEncountered(PlayerError error, any context); > }; > > > [JSImplementation="MediaPlayerDelegate"] > interface MediaPlayerJSDelegate { > void MediaPlayerJSDelegate(); > void PlayerStateChanged(PlayerState state, any context); > void PlayerStatus(StatusInfo status, any context); > void PlayerErrorEncountered(PlayerError error, any context); > }; > > > > But the generated code for the PlayerStatus method won't compile. My > glue.cpp file looks like this: > > void PlayerStatus(Arris::StatusInfo arg0, void* arg1) { > EM_ASM_INT({ > var self = Module['getCache'](Module['MediaPlayerJSDelegate'])[$0]; > if (!self.hasOwnProperty('PlayerStatus')) throw 'a JSImplementation > must implement all functions, you forgot > MediaPlayerJSDelegate::PlayerStatus.'; > self['PlayerStatus']($1,$2); > }, (int)this, (int)arg0, arg1); > } > > > Why isn't arg0 a StatusInfo *? > > If I make the change manually it builds but making the callback generates an > exception. The other two methods work fine. > > Any suggestions? > > ------- > Scott > > -- > You received this message because you are subscribed to the Google Groups > "emscripten-discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to emscripten-discuss+unsubscr...@googlegroups.com <>. > For more options, visit https://groups.google.com/d/optout > <https://groups.google.com/d/optout>. > > > -- > You received this message because you are subscribed to the Google Groups > "emscripten-discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to emscripten-discuss+unsubscr...@googlegroups.com > <mailto:emscripten-discuss+unsubscr...@googlegroups.com>. > For more options, visit https://groups.google.com/d/optout > <https://groups.google.com/d/optout>. > > > -- > You received this message because you are subscribed to a topic in the Google > Groups "emscripten-discuss" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/emscripten-discuss/RydKhN7fxqg/unsubscribe > <https://groups.google.com/d/topic/emscripten-discuss/RydKhN7fxqg/unsubscribe>. > To unsubscribe from this group and all its topics, send an email to > emscripten-discuss+unsubscr...@googlegroups.com > <mailto:emscripten-discuss+unsubscr...@googlegroups.com>. > For more options, visit https://groups.google.com/d/optout > <https://groups.google.com/d/optout>. -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-discuss+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.