I'm trying to compile a DLL in vc++ and use it in C# for 开发者_运维百科Smart Device. Is it possible and how?
You have to use PInvoke, and you probably need to expose the call from your unmanaged dll as extern "C". Have a look here. What you have to consider is that generally you can't use the classes you created in your C++ dll directly, but you need some extern "C"
facade inside the C++ dll that helps you to interoperate. In order to ensure exporting the entry points needed from the dll you should ensure proper export is done: http://msdn.microsoft.com/en-us/library/3y1sfaz2.aspx. As an helpful tool to discover what entry points the dll actually export you can use dumpbin. I never used it on compact framework, but this blog seems talk about it: http://geekswithblogs.net/BruceEitman/archive/2009/02/25/windows-ce-dumpbin.aspx. Basically with dumpbin you can have a drop of the names exposed from the dll to help you in PInvoke declaration.
Yes, it is. Look at P/Invoke.
精彩评论