Alright, so I'm stupid. I didn't need the DLLImport attribute at all in my previous example. In Managed C++ you can just call Win32 APIs directly right alongside all the CLR stuff. This is why Managed C++ rules!
I have a project coming up that needs a layer to talk to some Win32 APIs due to the fact that the Managed world doesn't support some things yet. What I plan to do is just implement a component layer that calls the Win32 APIs and presents a Managed-friendly interface for Managed components to use. If and/or when there is Managed support to do the things I need to use the Win32 API for, I just update the component to use that. The interface that managed clients call shouldn't have to change at all.
I have a contrived example that I may post tomorrow.
11:05:58 PM
|