I have an unmanaged C++ applications that connects to different data sources via vendor DLLs. For .Net framework DLLs I used to create /clr projects and it worked for me without any problems.
But now I need to use .Net 5 DLL, and can't make it work that way. to mix unmanaged and .net 5 code I have to use /clr:netcore which builds only as DLL, but my app should be a windows service, so I created a wrapper DLL for vendors .Net 5 DLL using /clr:netcore with a few exported methods(unmanaged). Used .def file to specify exported methods.
wrapper.h
typedef int(__stdcall* PHCallback)(void* client, LPCTSTR strItem, void* data);
void* __declspec(dllexport) CreateClient(LPCTSTR params);
bool __declspec(dllexport) Connect(void* client);
void __declspec(dllexport) SetCallback(void* client, PHCallback* pCallback);
void __declspec(dllexport) SendRequest(void* client, LPCTSTR request);
In this wrapper CreateClient creates an instance of an object defined in vendor's DLL so I could use it later in other methods. SetCallback sets a callback to be called when data is ready, nothing special.
Compiled the Wrapper.dll got .lib and .dll files - all good so far.
Then I tried to link my unmanaged app with that Wrapper.dll (using header file and .lib). Everything compiled fine... but when I try to launch/debug my app I got an error 'A dependent dll was not found'.
All .lib/.dll/.exe are in the same directory. If I open .exe with DependancyWalker - it says it can't find wrapper.dll too(why?) If I open wrapper.dll directly in DependancyWalker - it's shown and all my exported methods are there.
So what do I need to make this work? Or is it impossible to use .net 5.0 DLLs from unmanaged c++ this way?
I