Hi,
I will much likely work a lot with a COM+ API in the future namely DirectShow. The exaxt interop strategy is however foggy. In C++ DirectShow code would look like this:
IPin* pPin;
HRESULT hr = GetPin(&pPin);
if (FAILED(hr))
Return hr;
I've learned programing using .NET and found this way of programming very inconvenient and unproductive. A managed API designed after .NET guidelines would look like this in C#:
Pin pin = GetPin();
so what we got here is 1 line of code instead of 4 lines code not even counting releasing the interface which have to be done as well. Besides the amount of how many lines of code need to be written .NET has many other advantages as well of course. It makes code both a lot easier to write and read. I would like to wrap the DShow API in a way I can use it like my C# example meaning functions return things how it's supposed to be but not with out parameters, if a error occurs a exception get's thrown. The managed DirectX implementation is designed in this fashion using C++ managed extensions. The resources about how to implement such a API that I found are thin. I found a little page in MSDN called:
Implementing a Custom Runtime Callable Wrapper
it's a simple containment example where a ref class (new syntax for __gc class, I use the new C++/CLR of VS 2005 already) using a smartpointer containing the interface to wrap. I've made a little library very similar, it's not different than wrapping normal C++ object pointers. I wonder if somebody is working on a managed DShow implementation. I think it would already very usuful to have basic stuff available, it should be possible to mix this with runtime callable wrappers available with NETMasters DShowNET.dll. I couldn't help myself other than using reflector on the Managed DX implementation which as usual turned out to be very useful to understand how things work. Is anybody else here interested in this topic?
stax
I will much likely work a lot with a COM+ API in the future namely DirectShow. The exaxt interop strategy is however foggy. In C++ DirectShow code would look like this:
IPin* pPin;
HRESULT hr = GetPin(&pPin);
if (FAILED(hr))
Return hr;
I've learned programing using .NET and found this way of programming very inconvenient and unproductive. A managed API designed after .NET guidelines would look like this in C#:
Pin pin = GetPin();
so what we got here is 1 line of code instead of 4 lines code not even counting releasing the interface which have to be done as well. Besides the amount of how many lines of code need to be written .NET has many other advantages as well of course. It makes code both a lot easier to write and read. I would like to wrap the DShow API in a way I can use it like my C# example meaning functions return things how it's supposed to be but not with out parameters, if a error occurs a exception get's thrown. The managed DirectX implementation is designed in this fashion using C++ managed extensions. The resources about how to implement such a API that I found are thin. I found a little page in MSDN called:
Implementing a Custom Runtime Callable Wrapper
it's a simple containment example where a ref class (new syntax for __gc class, I use the new C++/CLR of VS 2005 already) using a smartpointer containing the interface to wrap. I've made a little library very similar, it's not different than wrapping normal C++ object pointers. I wonder if somebody is working on a managed DShow implementation. I think it would already very usuful to have basic stuff available, it should be possible to mix this with runtime callable wrappers available with NETMasters DShowNET.dll. I couldn't help myself other than using reflector on the Managed DX implementation which as usual turned out to be very useful to understand how things work. Is anybody else here interested in this topic?
stax