On Mon, Aug 7, 2023 at 7:52 AM 'Michael Hagar' via emscripten-discuss <
emscripten-discuss@googlegroups.com> wrote:
> It's mentioned in the docs here:
> https://emscripten.org/docs/porting/connecting_cpp_and_javascript/Interacting-with-code.html?highlight=memory_growth#access-memory-from-javascrip
Sample code working for me with emcc 3.1.44:
#include
using namespace emscripten;
template
class Foo
{
public:
Foo()
{
m_value = 0;
}
void add (T value)
{
m_value += value;
}
T m_value;
};
EMSCRIPTEN_BINDINGS(main) {
class_>("Foo_int")
.constructor<>()
.function("add", &Foo::add)
.property("
On Mon, Aug 7, 2023 at 7:52 AM 'Michael Hagar' via emscripten-discuss <
emscripten-discuss@googlegroups.com> wrote:
> It's mentioned in the docs here:
> https://emscripten.org/docs/porting/connecting_cpp_and_javascript/Interacting-with-code.html?highlight=memory_growth#access-memory-from-javascrip
It's mentioned in the docs
here:
https://emscripten.org/docs/porting/connecting_cpp_and_javascript/Interacting-with-code.html?highlight=memory_growth#access-memory-from-javascript
That if using the ALLOW_MEMORY_GROWTH option, the JS side needs to refresh
the views on the memory buffer.
If I us
Thanks! I haven't tested using the non-GROWABLE methods for heap access,
but that's good to know they shouldn't be needed.
On Friday, July 7, 2023 at 7:41:51 PM UTC-5 s...@google.com wrote:
> Yes, those methods are only used/needed/present when growable memory is
> combined with threads.
>
> Wh
Hi all!
here is a compiling example of a cpp templated class:
The question is is it possible to embind, for example for Foo the
member function
Foo::add?
When trying the naiive approach it failed.
Thanks!
Ronny
template
class Foo
{
public:
Foo()
{
m_value = 0;
}
void add (T value)
{
m_value +=
Thanks a lot Mike!
Looks like I will inherit a CTOR and use it with std::string
ב-יום שני, 7 באוגוסט 2023 בשעה 12:25:13 UTC+3, mike.l...@googlemail.com
כתב/ה:
> Here is the full compiling cpp code:
>
> #include
> #include
> #include
>
> class Foo
> {
> public:
> Foo(const char* a, con
> Here is the full compiling cpp code:
>
> #include
> #include
> #include
>
> class Foo
> {
> public:
> Foo(const char* a, const char* b, const char* c)
> {
> m_a = std::string(a);
> m_b = std::string(b);
> m_c = std::string(c);
> }
>
> private
Hi Ronny,
> Is it possible using the current EMBIND to pass one CPP class to another?
> For example:
> Here I tried constructing class Bar in the same binding declaration as Foo,
> and construct a Bar using Foo.
> Is it possible at all, and if yes how?
> Thanks
> Ronny
>
>
> EMSCRIPTEN_BINDINGS
Here is the full compiling cpp code:
#include
#include
#include
class Foo
{
public:
Foo(const char* a, const char* b, const char* c)
{
m_a = std::string(a);
m_b = std::string(b);
m_c = std::string(c);
}
private:
std::string m_a;
std
10 matches
Mail list logo