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. 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值