RickStrahl / wwDotnetBridge

.NET Interop for Visual FoxPro made easy
http://west-wind.com/wwDotnetBridge.aspx
73 stars 35 forks source link

Delegate support #11

Closed breyed closed 6 years ago

breyed commented 6 years ago

There isn't much guidance about delegates (or callbacks from .NET in general). Async support for blocking .NET calls is clear. But what about non-blocking callbacks, whether as delegates passed as parameters or bound to .NET events? Ideally, they're supported, but if not, it would be good for the documentation to state the limitations definitively.

The wwSmtp example seems to come the closest with a COM-based event. A non-COM-based solution would be preferable, or if not feasible, at least one that supports registration-free COM.

RickStrahl commented 6 years ago

It's not supported by wwDotnetBridge because FoxPro requires interfaces to map event sinks. Direct callback binding only works through COM - you implement a FoxPro interface to and register that and then .NET can call you back. You have to register your component with COM for that to work.

I don't know of a way to intercept that without the interface mapping.

There's more info on Event handling in the white paper.