Wrapping boost :: signal for C # delegates

Say I have an asynchronous library written in C ++ with an interface similar to this:

class connection { public: boost::signal< void() > sig_connection_made; boost::signal< void(const std::string&) > sig_error; void connect(const std::string& host, const std::string& port); }; 

which I want to wrap in C #. Does anyone know a way using SWIG or something similar that will allow me to associate signals with C # delegates?

+4
source share
2 answers

you can pass a delegate to C ++ from C # using SWIG, assigning it to a function pointer, then call the function pointer and it will call the delegate.

+1
source
+1
source

All Articles