1 / 32

SASC/C++ Cross-Platform Software

SASC/C++ Cross-Platform Software. SAS Institute Inc. Introduction. The tutorial is designed to help you implement the sascc370 driver in either the MS-DOS shell or the Microsoft Visual C++ IDE, not to replace the online Help.

floria
Download Presentation

SASC/C++ Cross-Platform Software

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. SASC/C++ Cross-Platform Software SAS Institute Inc.

  2. Introduction • The tutorial is designed to help you implement the sascc370 driver in either the MS-DOS shell or the Microsoft Visual C++ IDE, not to replace the online Help. • Please read the online Help for detailed topical information on all aspects of the SAS/C Cross-Platform Software.

  3. Topics Covered • Implementing the SASC/C++ driver in an MS-DOS shell. • Implementing the SASC/C++ driver in the Microsoft Visual C++ IDE.

  4. Topic One The sascc370 compiler driver controls the compilation of your C and C++ source code. Invoke the compiler at the DOS prompt with the following command: C:\> sascc370 [options] [filename1 [filename2…]] If specified, the options argument can be one or more of the compiler options described in the SAS/C Cross-Platform Compiler and SAS/C Cross-Platform C++ Development System Usage and Reference guide in Chapter 3, Compiling C and C++ Programs, or the cool options described in Chapter 6, Pre-Linking C and C++ Programs. Some of the compiler options (e.g., -v) are particular to the sascc370 driver, whereas others alter the compilation phases in some manner. The compiler driver processes these options during the phases of compilation, passing them to the appropriate executable file as necessary. If you do not specify any options, the cross-platform compiler will generate pre-linked, non-reentrant code by default. Pre-linking is accomplished by cool, which is normally invoked by the compiler driver.

  5. Command-line invocation of SAS/C An example showing the sascc370 driver executed within an MS-DOS shell at the command-line, with and without the verbose option -v. The -v returns detailed messages during the compilation. You can also set up batch files to execute SAS/C in MS-DOS

  6. Batch Files Compiling C/C++ Source Code The sample compile batch file on the next slide accepts a .c file and compiles the code to produce only an object deck ( -c ), allowing reentrant modification of static and external data ( -Krent ), and defining a section name as the source code filename ( -Ksname ). The –v option specifies that both driver messages and the command lines that execute each phase of the cross-platform compiler are echoed to the %LOG% file. If the source file is not in the current working directory, the quoted, qualified pathname should be entered as the second command-line argument.

  7. Batch Files set NAME=%1 set PATHNAME= if NOT ‘%2’ == ‘’ set PATHNAME=%2\ set SOURCE=%PATHNAME%%NAME%.c set OBJECT=%NAME%.obj set LOG=%NAME%.clg set C_OPTS=-c –v –Krent –Ksname=%NAME% erase %LOG% erase %OBJECT% sascc370 %C_OPTS% %SOURCE% -o %OBJECT% > %LOG% echo done with %NAME% The correct syntax to invoke this sample compile.bat file would be: C:\compile sourcename [pathname] For example, to compile the file d:\program files\sasc\samples\c\ftoc.c and produce ftoc.obj in the current working directory, the command line invocation would be: C:\compile ftoc “d:\program files\sasc\samples\c” Where ftoc on the command line is the source code filename without an extension.

  8. Batch Files Pre-Linking Object Code The sample pre-link batch file on the next slide accepts as input the previously compiled object code filename (without the .o extension ) and produces pre-linked output from cool. The –v option specifies that any driver messages, and the command lines that execute cool, are echoed to the %LOG% file. If the object file is not in the current working directory, the quoted, qualified pathname should be entered as the second command-line argument.

  9. Batch Files set NAME=%1 set PATHNAME= if NOT ‘%2’ == ‘’ set PATHNAME=%2\ set OBJECT=%PATHNAME%%NAME%.obj set OUTPUT=%NAME% set LOG=%NAME%.llg set L_OPTS=-v erase %LOG% erase %OUTPUT% sascc370 %L_OPTS% %OBJECT% -o %OUTPUT% > %LOG% echo done with %NAME% The correct syntax to invoke this sample link.bat file would be: C:\link objectname [pathname] For example, to pre-link the object file ftoc.obj and generate ftoc, the command line invocation would be: C:\link ftoc Where ftoc on the command line is the object code filename without the .obj extension.

  10. Batch Files Building Source Code To compile and then pre-link source code in one step, you could execute the batch file on the next slide. The sascc370 driver would execute the SAS/C C and C++ Cross-Platform Compiler and then produce pre-linked output generated by cool. In this example, the compiler options specify reentrant code, extended names processing ( -Kextname ), a section name, run-time type identification ( -Krtti ), and automatic instantiation of class templates ( -Kautoinst ). A quoted include pathname is added for user-defined header files. The command line that executes each phase of the cross-platform compiler is displayed in the %LOG% file.

  11. Batch Files REM Assumes a C++ source file with .cxx extension set NAME=%1 set PATHNAME= if NOT ‘%2’ == ‘’ set PATHNAME=%2\ set SOURCE=%PATHNAME%%NAME%.cxx set OUTPUT=%NAME% set LOG=%NAME%.log set BLD_OPTS=-v –Krent –Kextname –Ksname=%NAME% -Krtti –Kautoinst set INCL= -I“d:\program files\sasc\samples\h” erase %LOG% erase %OUTPUT% sascc370 %BLD_OPTS% %INCL% %SOURCE% -o %OUTPUT% > %LOG% echo done with %NAME% The correct syntax to invoke this sample build.bat file is: C:\build sourcename [pathname] For example, to compile and pre-link the file d:\program files\sasc\samples\cxx\tsttmpl.cxx, the command line invocation would be: C:\build tsttmpl “d:\program files\sasc\samples\cxx” Where tsttmpl on the command line is the C++ source code filename without the .cxx extension. The compiler will generate the object file, tsttmpl.obj.

  12. NMAKE and make files MS-DOS and Microsoft Visual C++ IDE can be bridged by a MAKE file ... The Microsoft IDE automatically generates a MAKE file with extension .mak during the building of a project and all sub-projects. You can also export a current MAKE file within the IDE by selecting the Project pulldown menu and then choosing the Export Makefile… option. By editing the .mak file associated with your project, you can determine the execution process by which the Microsoft IDE builds the project configuration. By invoking NMAKE from within the MS-DOS shell, the appropriate .mak file can be executed accordingly. In addition, you can select the Project pulldown menu and select Settings… Then under the Post-build step tab you can enter the nmake command. (Microsoft Visual C++ Version 5.0 only)

  13. NMAKE and make files Following is an example .mak file generated by the Microsoft IDE: # Microsoft Developer Studio Generated NMAKE File, Based on ftoc.dsp !IF "$(CFG)" == "" FG=ftoc - Win32 Release !MESSAGE No configuration specified. Defaulting to ftoc - Win32 Release. !ENDIF !IF "$(CFG)" != "ftoc - Win32 Release" && "$(CFG)" != "ftoc - Win32 Debug" !MESSAGE Invalid configuration "$(CFG)" specified. !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: !MESSAGE NMAKE /f "ftoc.mak" CFG="ftoc - Win32 Debug” !MESSAGE Possible choices for configuration are: !MESSAGE "ftoc - Win32 Release" (based on "Win32 (x86) Console Application") !MESSAGE "ftoc - Win32 Debug" (based on "Win32 (x86) Console Application") !ERROR An invalid configuration is specified. ENDIF

  14. NMAKE and make files !IF "$(OS)" == "Windows_NT" ULL= !ELSE NULL=nul !ENDIF !IF "$(CFG)" == "ftoc - Win32 Release" OUTDIR=. INTDIR=. !IF "$(RECURSE)" == "0" ALL : ".\ftoc.out" !ELSE ALL : ".\ftoc.out" !ENDIF CLEAN : -@erase "$(INTDIR)\ftoc.obj" -@erase ".\ftoc.out" "$(OUTDIR)" :

  15. NMAKE and make files if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)" CPP=c:\keith\host\wnt\bin\sascl.exe CPP_PROJ=/ML /Fo"$(INTDIR)\\" -v CPP_OBJS=./ CPP_SBRS=. .c{$(CPP_OBJS)}.obj:: $(CPP) @<< $(CPP_PROJ) $< << .cpp{$(CPP_OBJS)}.o:: $(CPP) @<< $(CPP_PROJ) $< << .cxx{$(CPP_OBJS)}.obj:: $(CPP) @<< $(CPP_PROJ) $<

  16. NMAKE and make files RSC=rc.exe BSC32=bscmake.exe BSC32_FLAGS=/nologo /o"$(OUTDIR)\ftoc.bsc" BSC32_SBRS= \ LINK32=c:\keith\host\wnt\bin\slink.exe LINK32_FLAGS=ftoc.obj /incremental:no /pdb:"$(OUTDIR)\ftoc.pdb" /machine:IX86\ /out:"ftoc.out" -Tcms370 -v LINK32_OBJS= \ "$(INTDIR)\ftoc.obj" ".\ftoc.out" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) $(LINK32) @<< $(LINK32_FLAGS) $(LINK32_OBJS) !ELSEIF "$(CFG)" == "ftoc - Win32 Debug” !ENDIF

  17. Topic Two In order to execute the SAS/C Cross-Platform software from within the Microsoft Visual C++ Integrated Development Environment it is necessary to have integrated the software into the Registry during the installation process. If you are unsure, type the following in an MS-DOS shell: C:\sashelp.hlp This opens the online Help. Select the article “Updating the Registry after Installation” under the “Installation” topic. This process updates the Registry so that you are able to execute the sascc370 driver from within the IDE. Currently only Versions 4.2 and 5.0 of the Microsoft Visual C++ IDE are supported.

  18. Layout#.reg file • Open a Regedit session • Start | Run | Regedit • Open Registry pulldown menu item • Select Import Registry File… and Browse to the “layout#.reg” file in the installed SAS/C software host\wnt\bin directory where # is either 50 or 60, reflecting the version of the Microsoft Visual C++ IDE installed on your PC.

  19. sascc370 in MSVC++ MSVC++ Version 4.2 option 3 only MSVC++ Versions 5.0 and 6.0 All three options After the installation of the SASC/C++ Cross-Platform software with Microsoft integration, the Registry is updated, enabling additional Menu Bar options in the Microsoft Visual C++ Integrated Development Environment. These Menu Bar changes are: 3 1 SAS/C 2 Tools Compiler Options SAS/C Help Files under three menus on the Toolbar Help

  20. Compiler Options Dialog Box This dialog is accessed on the Menu Bar by opening the SAS/C menu and the Compiler options item. The online help files and tutorial are available. You can create a diagnostic file for Technical Support and force cool to call the libcxx.a archive.

  21. Compiler Options dialog Box Dialog box online Help and PowerPoint tutorial The Compiler Options dialog box offers the user a choice between implementing the sascc370 compiler driver, generating a pre-linked output file, and the Microsoft compiler and linker. A comprehensive diagnostic log file for use by SAS Institute Inc. Technical Support can be generated. You can force the utility cool to call the archive libcxx.a in the event that a project containing both C and C++ source files fails to do so.

  22. SAS/C Help Dialog Box The SAS/C Help dialog box accesses a comprehensive suite of online help files arranged into a logical library of books. You can find the appropriate subject matter by selecting a Contents tab, an alphabetically arranged Index tab or by typing in the first few letters of a subject in the Find tab. For easy navigation, there are helpful links between the topics. All pages may be printed.

  23. SAS/C Help Dialog Box • This dialog is accessed on the Menu Bar, by opening the SAS/C menu and the SAS/C Help Files item.

  24. sascc370 IDE project options • In the Project Settings dialog box, select the General tab and delete the Microsoft entries in the Output directories text boxes. • Under the C/C++ tab select General in the Category drop-down menu, and delete all the Microsoft Project Options. • Enter any sascc370 compiler options in the Project Options text box. • Under the C/C++ tab select Preprocessor in the Category drop-down menu, and enter any additional include directories and preprocessor definitions. • Under the Link tab select General in the Category drop-down menu, and delete all the Microsoft Project Options. • Enter any sascc370 pre-linker options in the Project Options text box. Only options intended for the pre-linker cool are to be placed here. • The Post-build tab allows you to enter any applications that you wish to run after the build process, such as ftp_mvs.bat to transfer files to the mainframe.

  25. sascc370 in MSVC++ It is necessary to delete both entries in the Output directories text boxes.

  26. Project level settings for C/C++ • After deleting ALL the Microsoft Project Options, you enter the sascc370 compiler options that are applicable at the project level.

  27. Project level settings for Link • After deleting ALL the Microsoft Project Options, you enter the sascc370 pre-linker (cool) options that are applicable at the project level.

  28. sascc370 IDE source file options • For each source file in the Settings For text box in the Project Settings dialog box, you can set options at the source file level: • Select the C/C++ tab and General from the Category drop-down menu, and enter any preprocessor definitions. • Select Preprocessor from the Category drop-down menu, and enter any additional include directories. • In the Undefined symbols text box you enter any sascc370 options for the compiler that are to be allocated to the selected source file. These driver options are not defined by the Microsoft IDE, and are only applicable to sascc370. A /U will prefix any options entered in this area when viewed in the Source File Options text box. The sascc370 driver ignores the /U, and passes any associated options to the appropriate phases of compilation. The next two slides show an example defining source file level options for ftoc.cpp. Note the additional options in the Source File Options text box.

  29. sascc370 IDE source file options Note that all section names greater than seven characters are truncated; hence “thisisa” would be the section name assigned to the file ftoc.cpp

  30. sascc370 IDE source file options • You can enter any compiler options that are pertinent to particular source files, such as -Ksname, in Undefined symbols. Such options are not defined by Microsoft.

  31. Executing an FTP batch file • You can execute a post-build application, such as the process of transferring files to the mainframe for final linking and load module generation. Only available in Versions 5.0 and 6.0 of the Microsoft Visual C++ IDE.

  32. Uninstall Process There are two major steps to uninstalling the SAS/C product: • Execute the appropriate “uninstall#.exe” file if the software was integrated into the Microsoft IDE PRIOR to the next step. (# = 42, 50 or 60) • Start | Settings | Control Panel | Add/Remove Programs and select the SASC 6.50.03 software.

More Related