I have spent several hours looking for the answer so I figured out that if I ask myself I could finally end up with a solution to my problem. First, to describe what I want to do:
So, to describe the design above, I have a .dll plugin written in pure c++ ( I don't want it to contain any .Net code). This c++ plugin will be used from a software platform. Now, I want the c# windows service to interact with the software platform, but it only can do it through the c++ dll. For this reason, I wrapped all the functionality of the c++ plugin into the Wrapped Dll (I exported the functionality) and I am using the Wrapped Dll into the c# windows service.
Now, I have a test method to check if the export of the c++ functionality is working ok, (just a simple method that returns the sum of two integers) and I can see that the windows service can interract with the c++ unmanaged dll in the correct way, I am getting the correct results. The problem I have is when I try to interact with the Software platform through the c++ unmanaged dll. I get the following error:
I realized that the error should be because the unmanaged dll cannot be accessed by the Software Platform and the Wrapped Dll at the same time. To solve this, I found out that the solution is to add the unamanaged dll in the GAC. But to put a dll in the GAC, the dll has to have a strong name, but I found out that I cannot sign a strong name to unmanaged code unless I have the /clr option enabled. But when I have this option enabled the unmanaged dll doesn't compile.
To summarize, is there any way I can get my unmanaged dll to be access by the software platform and from the wrapped dll? Without the integration of .Net in my unmanaged code?
I have spent a lot of hours searching for the solution so it would be great if any of you can show me a little light in the tunnel!
Thank you