Astronaut
Astronaut

Reputation: 7051

C++ DLL in C# WinMobile 6.1 Project - 1c2 machine (Thumb) vs 14c machine (x86)

I am trying to import a few DLLs that have been compiled for 1c2 machine (thumb) into a WinMobile 6.1 C# Smart Device project.

However when i try to import them to my C# project I get "A reference to ... cannot be added", I can add DLLs that have been compiled for 14C machine (x86), my C# WinMobile project has Any CPU as it's setting, is it possible to import 1C2 machine DLLs or do I need these to be recompiled to 14C machine x86?

DLL Import

Upvotes: 0

Views: 216

Answers (1)

ctacke
ctacke

Reputation: 67198

You can't do what you're trying to do. You can't just "add a reference" to a native DLL from managed code. "Add Reference" is specifically for adding managed references.

If you want to call your native DLL from managed code, you must write and call P/Invoke interop functions. Even then, you can only call publicly exported C functions (not C++, unless it has a COM interface), so you may also have to write C stubs, or some form of factory functions to proxy any C++ calls you wish to make.

Upvotes: 2

Related Questions