-
Notifications
You must be signed in to change notification settings - Fork 25
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
Support interfaces as callbacks from C++ (in addition to std::function support) #2
Comments
Thanks! |
Good to hear! Yea I found the way to do callbacks but that doesn't fully meet my needs. I need entire interfaces to be implemented in the client language and have it passed to C++. |
@Boris-Rasin do I understand correctly that using c++ interfaces in client languages is impossible now? For instance, I have an interface Foo, it's implementation and the factory Bar that produces Foo. Bar.h #include <memory>
#include <scapix/bridge/object.h>
#include "Foo.h"
class Bar : public scapix::bridge::object<Bar> {
public:
std::shared_ptr<Foo> getFoo() {
return std::static_pointer_cast<Foo>(std::make_shared<FooImpl>());
}
}; Foo.h #include <scapix/bridge/object.h>
class Foo : public scapix::bridge::object<Foo> {
public:
virtual ~Foo() = default;
virtual void baz() = 0;
};
class FooImpl : public Foo {
public:
void baz() override {}
}; client's code val bar = Bar()
val foo = bar.getFoo() // SIGABRT here
foo.baz() |
dmalukov, this issue is about support for interfaces as callbacks from C++ (in addition to std::function support). Your example is supposed to work. I will take a look. Can you open a different issue for it? |
Interfaces as callbacks from C++ (overriding C++ virtual functions in bridged languages) are supported in the latest version of Scapix, currently for Python bridge only. Support for other languages coming soon, stay tuned! |
Added support for overriding C++ virtual functions in JavaScript bridge (now supported in Python and JavaScript bridges). |
First for all: very interesting project! I was testing it for a new project but I need the ability to implement a C++ interface in the "client" languages.
I could see from https://github.com/scapix-com/example1/blob/a0a0b5a27e4c68c1e2f6bb210901206ff378b213/source/chat/contact.h there is some traces of something along those lines (scapix::bridge::interface). What is the current status of this? Was it scratched or is it coming in the pipelines?
The text was updated successfully, but these errors were encountered: