C++ & C#, how to create wrapper dll in C++ for C# to call instance function in C++ dll?
- by 5YrsLaterDBA
Received an unmanaged C++ dll with instance functions which need to be called from my C#. need to write a wrapper C++ dll to bridge the C# and original C++ dll as suggested by experts here. it is new to me and want to learn from you.
Header file of the original C++ dll likes this:
class EXPORT_MACRO NB_DPSM
{
private:
string sFileNameToAnalyze ;
public:
NB_DPSM(void);
~NB_DPSM(void);
void setFileNameToAnalyze(string FileNameToAnalyze) ;
int WriteGenbenchData(string& message) ;
};
Start from a Class Library project template or CLR Empty Project template?
What's the wrapper code should look like?
Anywhere has step by step example for this?
thanks,