C++ MFC 64bit : setting up environment with existing DLLS to link

A couple of issues.

  1. I initially loaded my Plugin using the Release folder. Later I wished to use the Debug folder. However, it was not possible for me to understand how to change the stored path of the Plugin from within Rhino. I had to change the path by directly modifying the registry key.

  2. I have defined this function in my extension DLL (the main CPP module of the extension DLL):

BOOL switch_to_local(BOOL mode)
{
static HINSTANCE oldinst;
if(mode == TRUE)
{
oldinst = AfxGetResourceHandle();
AfxSetResourceHandle(theinstance);
}
else if (mode == FALSE) AfxSetResourceHandle(oldinst);
}
However it does not work (but it had in the past, as I did use it) because when AfxGetResourceHandle() is called, the current resource handle is NULL. And this implies an assertion of the inline function already mentioned.
AFXWININLINE HINSTANCE AFXAPI AfxGetResourceHandle()
{ ASSERT(afxCurrentResourceHandle != NULL);

So when the Plugin takes the control, the current Resource handle is set to null. Subsequent calls to AfxGetResourceHandle will lead to a crash.