This approach will only work if there is an active part in the session as KF environment doesn't work on a empty session. There are other limitations to it as well.
I then thought, I can develope a warpper dll using managed C++ which will act as a layer between my C application and .NET dll. My thought is to have wrapper functions (in C style and exposed) inside managed cpp wrapper dll which would call methods from .NET dll and my C application would call these wrapper functions from managed cpp dll.
This is my managed wrapper looks like
extern __declspec(dllexport) int MyMethod(char* _MyArg1, char* _MyArg2)
My C application is able to trigger the wrapper functions from managed cpp library, but managed cpp function is failing to trigger method from .NET dll as NX is not loading. How do I make this work? Appreciate your help.