> On Apr 25, 2020, at 13:18, キャロウ マーク <[email protected]> wrote:
> 
> I am trying to figure out how to do the equivalent with webidl_binder. I 
> created a
> 
>    struct UploadResult {
>        val texture;
>        GLenum target;
>        GLenum error;
>    };
> 
> in my c++ class and a matching interface in the idl and this is what the 
> method is declared to return. My current attempt is
> 
>            UploadResult ur;
>            val texture = val::module_property("GL")["textures"][texname];
>            ur.texture = std::move(texture);
>            ur.target = target;
>            ur.error = error;
>            return std::move(ur);
> 
> I am getting errors about “implicitly-deleted default constructor” for both 
> ur and val. The use of  `val` here raises another question. How do I look 
> something up in module_property?
> 

I almost have it working with

            UploadResult ur(
                val::module_property("GL")["textures"][texname],
                target = target,
                error = error);
            return std::move(ur);

where UploadResult is

    struct UploadResult {
        val texture;
        GLenum target;
        GLenum error;

        UploadResult() { };
        UploadResult(val texture, GLenum target, GLenum error)
             : texture(texture), target(target), error(error) { }
    };

The relevant IDL is

interface WebGLObject {
};

interface WebGLTexture : WebGLObject {
};

interface UploadResult {
    [Value] readonly attribute WebGLTexture texture;
    readonly attribute GLenum target;
    readonly attribute GLenum error;
};

interface texture {
    void texture(Uint8Array fileData);
    [Value] UploadResult glUpload();
    …
}


However, there is still 1 problem:

The stub in the generated .cpp file is attempting to put the UploadResult into 
a temporary stack variable which raises the “implicitly deleted default 
constructor error”. If I make a no args constructor then the message changes to 
 "call to deleted constructor”.


-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/emscripten-discuss/FA99C489-0E5C-4992-94F3-1D7BD19EEF32%40callow.im.

Attachment: signature.asc
Description: Message signed with OpenPGP

Reply via email to