Watcom does not support features

Source: Internet
Author: User
* 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", 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. 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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.