I found this How to export C# methods? answer which solved my problem partially i.e. I used this https://sites.google.com/site/robertgiesecke/Home/uploads#TOC-Version-1.1.3 (as suggested by SLaks) template to call my dll in native C++ code.
I am facing two problems while using this Unmanaged Exports template, I can't say for sure if they are being caused due to this template or do they have to do something with Interoperability of C# and C++.
The first problem was this, when i tried to call a function of a third party .NET DLL from my .NET DLL which was in turn being called by Native C++ code it gave an error:
Native C++ --> MyDLL (.NET DLL) --> ThirdParty.NET DLL
I found the solution here Problem in using a .net dll from c++ dll via c++/cli layer I had to sign my DLL.
Now the second problem is:
When I try to do the samething with WCF Service i.e. Adding a reference of WCF Service in MyDLL initalizing it and calling functions, the program breaks at C++ end
Native C++ --> MyDLL (.NET DLL) --> WCF Service Reference
I even tried doing this and it worked till AnotherDLL (which was signed) but broke at WCF
Native C++ --> MyDLL (.NET DLL) --> AnotherDLL (.NET DLL) --> WCF Service Reference
What I have found out till now is that whenever I try to initalize anything class from the WCF Service (Service Client, DataContract class it breaks).
If anyone has any idea, I would really appricate it and what else would be the best approach for this problem.
Thanks