Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: same address with diffrent object can't be export #35

Open
adintr opened this issue Sep 11, 2024 · 0 comments
Open

bug: same address with diffrent object can't be export #35

adintr opened this issue Sep 11, 2024 · 0 comments

Comments

@adintr
Copy link

adintr commented Sep 11, 2024

TestCode:
class A
{
public:
int getVal() const { return m_a; }
private:
int m_a = 10;
};

class B
{
public:
A* getA() {
return &m_a;
}

private:
A m_a;
};
...
static B test;
dukglue_register_method(m_ctx, &A::getVal, "getVal");
dukglue_register_method(m_ctx, &B::getA, "getA");
dukglue_register_global(m_ctx, &test, "test");
...
run script "test.getA().getVal()" get an error.
test.getA() not return the object of type A, return value still B.
the script "test.getA().getA().getA()" is good.

In C++, diffrent object maybe have same address, but when export to dukglue, it buffered address and object, same address always be the object first export.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant