watcom 不支持特性

    * DJGPP:
          o gcc -O2 -o djgpplba.exe djgpplba.c
    * WATCOM:
          o wcl386/l=dos4g djgpplba.c
          o wcl/l=dos djgpplba.c

For Open Watcom, the compiler option is -bd. This option must be used with at least one module and is required for proper DLL startup code to be linked in.

 Setting up Open Watcom (Win32) on Linux
Some simple tests

Make a test file 'test.c'

#include <stdio.h>
void main(void)
{
    printf("Hello Linux world!/n");
}

Type:

wine wcl386 -bcl=linux test.c
chmod u+x test.elf
./test.elf

Nice. It can build Linux executables :-) Then try:

wine wcl386 -bcl=nt test.c
wine wdw test

Hey, source debugging of a Win32 program. It Works(tm)!

The ide looks reasonably nice, and can build and run targets:

wine ide



http://www.openwatcom.org/index.php/Open_Watcom_STL#.3Calgorithm.3E
 Special Features

OWSTL contains a number of special features. In this section we highlight those features.
[edit]
Case insensitive string comparisons

After doing #include <string> a special instantiation of std::basic_string named watcom::istring is available that does all comparisons in a case-insensitive manner. For example

#include <string>

void f( )
{
  watcom::istring s( "HELLO" );
  if( s == "hello" ) {
    // Matches "HELLO", "Hello", "HeLlO", etc.
  }
  watcom::istring::size_type result = find( s, "ell" );  // Returns 1.
}

[edit]
Simple Local Names

OWSTL is written without the extensive use of underscore characters that one typically finds in STL implementations. For example, consider OWSTL's version of for_each

template< class InputIterator, class Function >
Function for_each( InputIterator first, InputIterator last, Function f )
{
  while( first != last ) {
    f( *first );
    ++first;
  }
  return( f );
}

This is to be contrasted with a more common style that looks like

template< class __InputIterator, class __Function >
__Function for_each( __InputIterator _first, __InputIterator _last, __Function _f )
{
  while( _first != _last ) {
    _f( *_first );
    ++_first;
  }
  return( _f );
}

We feel that the extensive use of underscores obscures the code and makes it difficult to read. Thus we avoid them.


Using Import Libraries

For this and other reasons, the import directive is somewhat difficult to use and manage. There is a another way which is much easier to use: import libraries.

An import library is a file with .lib extension which contains special records that store exactly the same information supplied to the import directive. Import libraries are used in the same way as traditional static libraries, but instead of the actual symbols they only contain "pointers" to their implementation in a separate DLL.

Import libraries are created by the Open Watcom library manager, wlib. There are several ways in which wlib can create import libraries; see the Open Watcom C/C++ Tools User's Guide for details. The simplest and most common way to create import libraries is the implib option of wlink (the linker will call wlib behind the scenes). The full syntax is:

OPTION IMPLIB[=imp_lib]

Simply using option implib when linking bar.dll will create bar.lib with import records for all symbols exported by the DLL. This import library is then used whenever a module wants to import a symbol from bar.dll. The user need not worry about name mangling or adding new and removing old exports, the entire process is automatic. 

你可能感兴趣的:(function,underscore,import,library,Instantiation,Pointers)