​OK thanks. And did I understand correctly that pointers only work for
non-primitive data types?​

On 26 October 2016 at 00:11, Alon Zakai <[email protected]> wrote:

> Yes, WebIDL focuses on simple types that map directly to JS (numbers,
> pointers, etc). embind has more functionality for sophisticated mappings of
> C++ classes, like std::vector.
>
> On Tue, Oct 25, 2016 at 2:39 PM, Philipp Gloor <[email protected]>
> wrote:
>
>> I have a C++ function that should return a vector of doubles but on the 
>> WebIDL
>> doc page
>> <https://kripken.github.io/emscripten-site/docs/porting/connecting_cpp_and_javascript/WebIDL-Binder.html>
>>  I
>> found nothing that could help me.
>>
>> The header file:
>>
>> #ifndef __JSAPI_H__
>> #define __JSAPI_H__
>>
>> #include <string>
>> #include "annotation.h"
>>
>> class JSAPI
>> {
>>     Annotation* annotations;
>> public:
>>     char* getAnnotContent(int annotID);
>>     std::vector<double> getAnnotRect(int annotID);
>>
>> };
>>
>> #endif
>>
>> And the implementation
>>
>> #include "jsapi.h"
>>
>>
>> char* JSAPI::getAnnotContent(int annotID)
>> {
>>     return annotations[annotID].content;
>> }
>>
>> std::vector<double> JSAPI::getAnnotRect(int annotID)
>> {
>>     return annotations[annotID].rect;
>> }
>>
>> And I'm looking for the proper definition of
>>
>> interface JSAPI
>> {
>>     void JSAPI();
>>     DOMString getAnnotContent(long annotID);
>>     std::vector<double> getAnnotRect(long annotID);
>> };
>>
>> Is something like this even possible? Or do I need to switch to embind
>> for this?
>>
>> --
>> 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].
>> For more options, visit 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/18GjJeGOq08/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> 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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to