Chapter Contents

Previous

Next
SAS/C Cross-Platform Changes for Release 7.50

Release 7.50 Changes to the SAS/C Cross-Platform Compiler User's Guide


Updates to Compiler Options

In Chapter 3, "Compiling C and C++ Programs," in the section titled "Option Summary," in the table labeled "Compiler Options," make the following changes to the indicated entries:

Update the following entries in the list of options in the section titled "Option Descriptions:"


Updates to the ar370 Archive Utility

In Chapter 7, "ar370 Archive Utility," add the following updates to the specified sections.

Update to the Introduction

In the "Introduction," replace the second paragraph with the following text:

An ar370 archive is organized as a collection of members, identified by a member name that resembles a filename. Member names are limited to 18 characters total length. Member names are not significant as far as resolving external references; however, the member name is important for maintaining the archive. For each object file contained in an ar370 archive, the ar370 utility records the names of external symbols defined or referenced in the member (including external objects with extended names). This allows cool to find the member that defines a particular symbol. No connection is required between an ar370 member name and the external symbol names defined by the member.

Update to Optional Modifier Characters

In the section titled "Optional Modifier Characters," add the -y command modifier to the table.

ModifierCharacters Description
y
Yes: List the mangled name along with the demangled name. The y modifier is meaningful only when used with the e (enumerate) optional modifier.


Update to Combinations of Command and Modifiers

In the section titled, "Combinations of Command and Modifiers," update the table labeled "Command and Command Modifier Combinations" with the -y command modifier as indicated below:

Command and Command Modifier Combinations
Command Accepted Modifiers and Commands
d e, f, j, q, t, v, y
m e, f, j, q, t, v, y and a | b
r e, f, j, q, t, v, y and a | b
t d, e, f, j, m, r, v, x, y
x e, f, j, t, v, y


Update to Optional Modifier Characters

In the section titled "Optional Modifier Characters," add the following entry to the list of characters:
w Used in conjunction with the replace (r) command to allow truncation of member names at 18 characters.


Update to the -Aenexit and -Aenexitdata COOL Options

The following text and example code should be added to the information for the enexit and enexitdata options in Chapter 6, "Prelinking C and C++ Programs," under the section titled, "Cool Options."

For Release 7.50, support for the -Aenexit and -Aenexitdata options has been enhanced to allow you to use a DLL to create external symbols for extended names when running under Windows.

Note:   The way COOL selects external symbols for extended names is explained in Appendix 7, "Extended Names," of the SAS/C Compiler and Library User's Guide.  [cautionend]

The following userexitdll.cxx and StdAfx.cxx source files provide a shell for a DLL that functions as the user exit for the -Aenexit option. You can use this example source to develop a DLL that generates external symbols that meet the specific needs of your build system. The DLL entry point clkexit is defined here in the userexitdll.cxx file.


userexitdll.cxx
#include <string.h> #include <iostream.h> #include "stdafx.h" #include "userexitdll.h" BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ) { switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: case DLL_THREAD_ATTACH: case DLL_THREAD_DETACH: case DLL_PROCESS_DETACH: break; } return TRUE; } extern "C" { USEREXITDLL_API int clkexit(const char UserData[8], const unsigned char *ExtendedName, int ExtendedNameLength, int FunctionFlag, int OldId, unsigned int *NewId) { int retcode = 0; /* Replace code from here ... */ if (!strcomp(Userdata, "TESTDATA")) *NewId = OldIs +1; else *NewId = OldId; /* ... to here. */ return(retcode); } }

The ifdef block in userexitdll.h is the standard way of creating macros that make exporting from a DLL simpler. All files within this DLL are compiled with the USEREXITDLL_EXPORTS symbol defined on the command line. This symbol should not be defined on any project that uses this DLL. Any other project whose source files include this file see USEREXITDLL_API functions as being imported from a DLL, whereas this DLL sees symbols defined with this macro as being exported.


userexitdll.h
// userexitdll.h // #ifdef USEREXITDLL_EXPORTS #define USEREXITDLL_API __declspec(dllexport) #else #define USEREXITDLL_API __declspec(dllimport) #endif extern "C" { USEREXITDLL_API int clkexit(const char UserData[8], const unsigned char *Name, int NameLength, int FunctionFlag, int OldId, unsigned int *NewId); }

stdafx.cxx is the source file that includes just the standard include files.


stdafx.cpp
// userexitdll.pch will be the pre-compiled header // stdafx.obj will contain the pre-compiled type information #include "stdafx.h" // TODO: reference any additional headers you need in STDAFX.H // and not in this file

stdafx.h is the include file for standard system include files or project specific include files that are used frequently, but are changed infrequently.


stdafx.h
#if !defined(AFX_STDAFX_H__453C6E62_806B_11D5_87B6_00C04F38FCF0__INCLUDED_) #define AFX_STDAFX_H__453C6E62_806B_11D5_87B6_00C04F38FCF0__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 // Insert your headers here #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers #include <windows.h> // TODO: reference additional headers your program requires here //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. #endif // !defined(AFX_STDAFX_H__453C6E62_806B_11D5_87B6_00C04F38FCF0__INCLUDED_)

You should modify the *NewId = OldId assignment statement in userexitdll.cpp to assign the new symbols as required for your application. The example DLL will function as written, but it merely assigns the old value to the new value.

The function parameters for the user exit are described in Appendix 7, "Extended Names," of the SAS/C Compiler and Library User's Guide.

To compile the DLL you should create a Win32 Dynamic-Link Library Project with Microsoft Visual C++. You will need to define the USEREXITDLL_EXPORTS symbol in the preprocessor definitions for the Project Settings of the compilation for the DLL.

The syntax for the -Aenexit and -Aenexitdata options is as follows:

-Aenexit=dllname

-Aenexitdata=userdata

For example:

-Aenexit=C:\bin\userexit.dll

tells cool to use the userexit.dll located at C:\bin to process the external symbols for extended names.

And

-Aenexitdata=PKGA

passes the string PKGA to the userexit.dll as the UserData parameter.

Refer to the SAS/C Compiler and Library User's Guide and the SAS/C Cross-Platform Compiler and C++ Development System User's Guide for more information about the -Aenexit and -Aenexitdata options and extended names processing.


Chapter Contents

Previous

Next

Top of Page

Copyright © 2004 by SAS Institute Inc., Cary, NC, USA. All rights reserved.