1

I am trying to build a C# widget to run alongside a C++ service architecture. I am leveraging an existing C++ interface service that publishes/subscribes data and I am hooking it up to the C# visualization's callbacks.

So I've got a solution with a C# project and the C++ data interface project. The C++ interface project is compiling with /clr, /MDd, and /EHa, but it depends on a lot of libs that are compiled with /EHsc and MTd. The linker doesn't like it when those flags don't match.

If I change the data interface to use /MTd and /EHsc like its dependencies, it tells me that is inconsistent with /clr. I assume I have to get the C++ data interface to compile with /clr so it can talk to the C# visualization, right? But I don't own the C++ project's dependency libraries, so I can't change how they are compiled.

So my question is, can you get a C# application to talk to a C++ DLL when that DLL has dependencies that were compiled with the /MTd and EHsc options?

Reg Edit
  • 6,719
  • 1
  • 35
  • 46
Myca A.
  • 81
  • 7
  • You will have to get those libraries rebuilt. Or isolate them in a separate DLL, albeit that this doesn't usually end well. Having more than one copy of the CRT causes lots of misery if the library interface isn't clean. There's somebody out there that can solve your problem in less than 15 minutes, you won't find him here. – Hans Passant Jun 25 '14 at 20:30
  • 1
    Instead of creating a managed wrapper you can try to use a non-managed wrapper and call it with PInvoke (or even better, just call to the c++ service with PInvoke if you can) – Gusman Jun 25 '14 at 20:34
  • Thanks Gusman, I'll try to get PInvoke going and if that doesn't work, I'll get the see about getting the dependencies recompiled Hans! – Myca A. Jun 25 '14 at 21:01

0 Answers0