PTC MKS Toolkit Knowledge Base

Section:IO
Product:MKS Toolkit (TKPDev/TKEDev)
Version:
OS:All
Keywords:porting, migration, MFC
Category:Porting/Knowledge Base


How can I mix MFC and UNIX code in the same program?


Using MFC requires your code to include Microsoft standard header files, which clash with Toolkit header files. To resolve this, build your UNIX code with Toolkit into a stand-alone NuTCRACKER Platform DLL (see the Building Standalone DLLs in the Porting Shared Libraries chapter of the UNIX to Windows Porting Guide for more details).

Build this DLL in a Toolkit build environment. Then use VC++ to build the MFC code which loads the DLL you built from your UNIX code. (Remember the _NutEnableNuTC()/_NutDisableNuTC() calls around the UNIX code). Pay special attention to those calls which might block the thread. The MFC message cannot respond while the thread is blocked in a NuTCRACKER call.