Porting C++ Code from NT to UNIX 
by George F. Frazier


Example 1:
(a)
APP_CFLAGS = -Dmain=app_main - DWHAS_APP_MAIN 

(b)
extern "C"
int main(int argc, char *argv[]);
{
 ...
}


Figure 2:

RUN.dir             : directory where you want executables to go
COMPILE_OPTION      : can have the values: debug, optimized
APP_CFLAGS          : additional compilation flags for C compiler
APP_CCPPFLAGS       : additional compilation flags for C++ compiler
APP_LDFLAGS         : additional link flags (maybe specifying DLLs)
MWINIT_DEFINES      : list of -D<symbols> used to initialize
                    :      Mainwin in certain specific ways 
MWLOCALES           : list of country codes corresponding to the
                    :      resources you have prepared in res subdirectory
MIDL_IDL            : IDL file to be compiled with MIDL
MIDL_IID            : Iid file from MIDL (defualt: <idl_name>_i.c)
MIDL_PROXY          : Proxy implementation from MIDL (defualt: <idl_name>_p.c)
MIDL_HEADER         : Header with interfaces and GUIDs (defualt: <idl_name>.h)
MIDL_DLLDATA        : DLL data for proxy from MIDL (defualt: dlldata.c)
MIDL_TLB            : Type lib information from MIDL (defualt: <idl_name>.tlb)
                    :   this will be created in the {RUN.dir} directory.


Listing One
ifeq ($(COMPILE_OPTION), debug)
CFGSUFFIX=d
else
CFGSUFFIX=
COMPILE_OPTION=optimized
endif

RUN.dir=/TestBench/bin
PROG      = TestBench${CFGSUFFIX}
TYPELIB_FILES = ${PROG}.tlb
MIDL_TLB=${PROG}.tlb
WRESOURCE = ${PROG}.rc   # Windows resource
TRESOURCE = ${PROG}.rxt   # program
MIDL_IDL=${PROG}.odl
APP_CCPPFLAGS=-I/testbench/include -I${MWHOME}/../mfc400/include -DRW_NO_STL 
-D_REENTRANT

SOURCES =  \
    TestBench.cpp \
    main.cpp \
    
mwupdatedependencies=depend-sunos5

CPP_OBJS  = ${SOURCES:%.C=%.o}
CPP_OBJS := ${CPP_OBJS:%.cpp=%.o}
CPP_OBJS := ${CPP_OBJS:%.cxx=%.o}
OBJS      = ${CPP_OBJS:%.c=%.o}
SRCS      = ${SOURCES}

MAKE_VERBOSE=true
MWUSE_OLE_LIBS = true
LDEXTERNAL= \
        -lSimDef${CFGSUFFIX} \
        -lcddbutil${CFGSUFFIX} \
        -ltypes${CFGSUFFIX} \
        -lAltaString${CFGSUFFIX}
APP_LDFLAGS =  \
        -lActiveX1${CFGSUFFIX} \
        -lDLL1${CFGSUFFIX} 

__cplusplus = true

## MFC library related definitions.
## Removing these definitions disables linking with MFC.
## MFC_MODULE_TYPE can be one of the following: DLL, EXTENSION_DLL, EXE
MFC_MODULE_TYPE=EXE
MFC_LIB_ROOT=mfc400

include $(MWHOME)/make.rules.simple


2


