Navigation: Advanced Topics > Legacy Project System Reference >====== Name #pragmas ====== | |
#pragmas with the class name control aspects of linkage naming. However, the C programmer should also be familiar with C name mangling and extern declarations.
The following name #pragmas are available:
#pragma name(prefix ⇒ (none | modula | c | os2_lib | windows))
#pragma name(prefix ⇒ string)
#pragma name(upper_case ⇒ on | off)
A pragma can be used in the Project language, C++ code, Modula-2 code, or Clarion code. Some only work in certain places. A 'P' to the right of the pragma indicates it can be used in the Project language, a 'C' indicates it can be used in C++ code, a 'M' indicates it can be used in Modula-2 code, and a 'W' indicates that it can be used in Clarion code (CLW files).
#pragma name(upper_case ⇒ on | off) cp
This #pragma is available in C and C++ Only. It specifies whether public names should be converted to upper case. You would use this when interfacing to Pascal, or to third party C libraries. The default setting is off.
#pragma name(prefix) cpm
There are two forms of this #pragma:
In Modula-2: | name(prefix ⇒ (none | modula | c | os2_lib | windows)) |
In C and C++: | name(prefix ⇒ string) |
#pragma name(prefix ⇒ (none | modula | c | os2_lib | windows)) mp
This #pragma is available under Modula-2 (under C and C++ the syntax is slightly different - see #pragma name(prefix ⇒ string).
The name(prefix) #pragma specifies the prefix and case of the public names that the compiler uses. The public names are names for non-static procedures and external data objects. By default, SoftVelocity Modula-2 prefixes all external names with the name of the module followed by an '@' for data and a '$' for procedures. You will need to use this #pragma to interface to SoftVelocity C.
The prefix #pragma specifies which prefix scheme to use:
Modula | Use the SoftVelocity Modula-2 naming convention of prefixing all external names with the name of the module and an '@' or a '$'. |
none | Puts no prefix on external names. |
c | Use the C naming convention (adds an underbar, '_' to all external names). |
os2_lib | Use the OS/2 library standard (prefix all external names with the module name). |
windows | Use the Microsoft Windows external naming convention. |
#pragma name(prefix ⇒ string) cp
This #pragma is available under C and C++ Only. Under Modula-2 the syntax is slightly different - see #pragma name(prefix ⇒ (none | modula | c | os2_lib | windows)).
The value is a string specifying the prefix to all public names. An empty string specifies no prefix. The default prefix is an underbar.
If you wish to interface to SoftVelocity Modula-2, you can use this #pragma to specify the module prefix with a dollar ($) suffix. For example, to use the WrStr procedure from module IO:
#pragma name(prefix ⇒ “IO$”)
void WrCard(unsigned);
In C, a Pascal or Modula2 linkage specification can specify a module name within the linkage specification, in which case the use of this #pragma is not necessary.
The default setting is language-dependent. The Project System does not set a default value for this macro.