OS/2 codes: compiler keywords exporting a symbol from a DLL without .def
The most basic way to export a symbol from a DLL is to list entries below EXPORTS keyword in .DEF file. However, this works for Visual Age C++(VAC) and gcc, but not for Open Watcom C/C++(OW). OW uses its own linker script, .lnk file, and EXPORT keyword not EXPORTS. Because of this, if you want to write DLLs buildable by the above three compilers, you should maintain at least two files of .def for VAC and gcc, and .lnk for OW. This increases the complexity of maintence. As well as, whenever symbols are exported newly, they should be added to .def and .lnk themselves. This is very annoying. Instead, it would be very convenient if exporting symbols in the source itself. All three compilers provide keywords for this. 1. Visual Age C++ VAC provides _Export keyword and #pragma export directive. Especially, _Export may be used in in-line style. For example, void _Export dll_entry( void ); will export dll_entry() as a proper name according to its calling convention and linkage ...