I spent most of the nineties in the C++ world with the venerable MFC (Microsoft Foundation Classes) , ATL(Active Template Library) & its famous smart pointers.
I recently had to answer a question in the Sharepoint newsgroups related to using Sharepoint dlls in C++: I jumped on it as a kid in a candy store (to be honest my current candy store is Sharepoint 2010).
This is what I did:
Create a new CLR Console Application project :
The following code is generated :
Add a reference to the Microsoft.Sharepoint.dll :
Define the Microsoft.Sharepoint namespace:
Write your C++; since Sharepoint classes are managed classes, you have to use the new gcnew operator and you don’t have to call delete.
Run the application :
Don’t forget, Visual C++ is the only compiler that allows you to mix-up managed and native code (we call that IJW or “It just works”); and this without the overhead of the PInvoke layer.
This is quite simple, but it’s not your grandma’s C++ compiler anymore.