Skip to content

Create a Win Form dll in C# to be called from C

Opariti

Asked Jul 23, 2008, 2:30 AM EDT2 answers
Share
LinkedInX

Hi,

I'm dealing with the problem in subject and as I think that would have a general interest I'd like to have an already proven view on how to do it, whether undes Visual Studio or not.

My application is written in "old plain C" and needs some UI upgrading. I think that if I can do Win From menus in C# as dlls, then I could hook them to the application using C calls. Thanks for any help!

PS: I've fouund a solution but it's not generic, seems like the COM and .NET worlds have intergation problems in terms of development, although is obvious they coexist in the Windows OS

2 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • Mahesh Chand
    0
    It is not possible to use a .NET DLL in plain C. The only way C++ can use .NET and vice versa is via COM. So you will have to create a DLL in .NET and then only COM applications can use it. You will have to convert (Export) your .NET DLL to a COM DLL using DLLExport utility.
    0
  • 0
    Thanks Mahesh. As I said I've found a "way around" through a C++ dll wrapping another C# dll, alltogether called by the C application. The link between COM and .NEt is done via C++. Your detail adds the final point, that is the visibility of the C application to the C++ bridge.
    0