1

I want to create a WCF service with COM Interop with which I need to pass complex data. Preferrably an array of custom class objects. I am not sure how to achieve this and there is a lack of decent examples.

I only found one similar question on Stackoverflow here

Calling C# From Unmanaged C++ Passing Or Returning "Complex" Types

However, the solution was to just use a C++/CLI dll instead but this is not an option for me. The C++ application that will call it statically links the C++ runtime and I have been told that this mustn't be changed.

Community
  • 1
  • 1
TimR75
  • 379
  • 2
  • 13

2 Answers2

1

I want to create a WCF service with COM Interop

OK, but what direction do you want the call to go? For COM -> .Net you need to create a COM Callable Wrapper. For .Net -> COM you need to create a Runtime Callable Wrapper.

It sounds like you are trying to call .Net from COM, but then this begs the question why are you trying to call a WCF service via interop? If you want to call the service, then consume the service endpoint and call them.

tom redfern
  • 30,562
  • 14
  • 91
  • 126
0

Approach is unclear to me. I am not pretty much sure but same problem came to me for desktop App , If you want to use COM components better have a wrapper(RCW) around COM where you refer to PIAs(Primary interop Assemblies)

And then from your main Project(WCF service) refer to this wrapper project instead of directly refering to COM.

Anamay
  • 71
  • 1
  • 2
  • 10