How did you define StatusInfo in the idl file?

On Tue, Feb 13, 2018 at 12:05 PM, Scott Watson <wswat...@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.
>

-- 
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.

Reply via email to