views:

456

answers:

1

The windows forms control library project (C++) I writes uses an unmanaged dll. The unmanaged dll has a header file (a Cheshire cat). And I just include it in the control library project. And calls functions in the unmanaged dll (of course with proper marshaling). This compiles and builds. The problem is when I go ahead to add the control to the tool box of my scaffolding, which is a Managed C++ winform application, VS2005 complains that it is not a .Net module.

I have seen people converting using MFC dlls as windows forms controls. What am I doing wrong?.

+1  A: 

Maybe it's because VS2005 does not find your native .DLL. This .DLL is searched in the "normal" manner for native .DLLs:

  • Current directory (I think it is mostly the start-up dir of VS)
  • App direcotry (somewhere in %ProgramFiles%\Microsoft Visual Studio...)
  • %PATH% dirs.

You could try to put your native DLL somewhere in the above mentioned dirs and try if you get better results.

I would absolutely recommend to make your native part static and statically link it into your .NET project (if that is possible) because it would avoid the native .DLL finding problem. (This is what I did because of the many problems. For example we have a Translator tool [SDL Passolo] that can handle .NET DLLs and pack them into translator packages including all referenced DLLs...but only .NET DLLs but not native DLLs!).

rstevens
This is why I love programming. Seemingly complex problems have simple solutions; and vice versa :-)
rptony