Watcom DOS4GW Probs

Watcom DOS4GW Probs

Post by Gumbyt » Wed, 15 May 1996 04:00:00



Hello! I just got Watcom C and am wondering how I can make this DOS4GW
thing work.
Hmm--by reading the on-line documentation I see that a simple example
program is constructed thus:

#include <stdio.h>

void main(void) {
  printf("Hello world.\n");

Quote:}

okay, simple little C program. Then they give the command-line for the
compile step:

wcl386 /l=dos4g hello.c

well, this is where I have problems. The linker is telling me this:

WATCOM Linker Version 10.6
Copyright by WATCOM International Corp. 1985, 1996. All rights
reserved.
WATCOM is a trademark of WATCOM International Corp.
Warning(1107): file __WCL__.LNK: line(2): undefined system name: dos4g
loading object files
searching libraries
Error(3002): ** internal ** - format not decided
Error: Linker returned a bad status

Any ideas? Any help would be greatly appreciated.

Oh yeah, one other thing.

I compile the following file in both Watcom (with wcl test.c) and
Borland (bcc test.c):

******************************************************************

#include <conio.h>
#include <stdio.h>

int main(void)
{
  int  count = 0;
  char inchar[2];

  printf("Hello.\n");

  inchar[1] = 0;
  inchar[0] = 0;
  while ((inchar[0]=getch()) != 0x0d)
  {
    count++;
    printf("%s", inchar);
  } // End while

  printf("\nInput string was %d characters long.\n", count);
  getch();
  return 0;

Quote:} // End main

*****************************************************************

The Borland file (33k!) does exactly as I expect: prints out each
character as the user types them.
Watcom is weird (7k!): it don' prin' nothin' until the user hits
enter, and then it prints out the whole input string! What? Is this a
bug or something?

Anyways, thanks for any help with my little DOS4GW prob. I would
really like to learn to use it as an extender.

-=Gumbytwo=-

 "This content in no way reflects the opinions, standards, or policy of
 the United States Air Force Academy or the United States government."
+-------------------------------------------------------------+

"Kill a man, you're a *er; Kill many, you're a conqueror;
 Kill them all, you're a God." -- MEGADETH       Commodore 64!

 
 
 

Watcom DOS4GW Probs

Post by DUCROQUET Erw » Wed, 15 May 1996 04:00:00


I think that it is an installation probleme.
Do you have an official Watcom product?
When you install Watcom C, you must select DOS 32 bits as target
system.
Check if you have the directory lib386 in your watcom directory.

I hope it will work, because programming 32 bits DOS is
definitely cool comparing to 16 bits .

                                        Erwan Ducroquet
                                        Paris
                                        France

 
 
 

Watcom DOS4GW Probs

Post by Gumbyt » Wed, 15 May 1996 04:00:00


Quote:>I think that it is an installation probleme.
>Do you have an official Watcom product?
>When you install Watcom C, you must select DOS 32 bits as target
>system.
>Check if you have the directory lib386 in your watcom directory.
>                                    Erwan Ducroquet
>                                    Paris
>                                    France

I have an official version (box 'n' everything). I selected DOS AFAIK,
and the lib386 directory is there and is the same one that is on the
CD-ROM.
Does anybody know perhaps of any .lib or .h files that I need to
specifically include in my compilation? I imagine this is what the
problem is but I can't find any that match the description, other than
the regular libraries (plib3r.lib ? etc.)

-=Gumbytwo=-

 "This content in no way reflects the opinions, standards, or policy of
 the United States Air Force Academy or the United States government."
+-------------------------------------------------------------+

"Kill a man, you're a *er; Kill many, you're a conqueror;
 Kill them all, you're a God." -- MEGADETH       Commodore 64!

 
 
 

Watcom DOS4GW Probs

Post by Paul Hsie » Wed, 15 May 1996 04:00:00



> >I think that it is an installation probleme.
> >Do you have an official Watcom product?
> >When you install Watcom C, you must select DOS 32 bits as target
> >system.
> >Check if you have the directory lib386 in your watcom directory.
> >                                       Erwan Ducroquet
> >                                       Paris
> >                                       France

> I have an official version (box 'n' everything). I selected DOS AFAIK,
> and the lib386 directory is there and is the same one that is on the
> CD-ROM.
> Does anybody know perhaps of any .lib or .h files that I need to
> specifically include in my compilation? I imagine this is what the
> problem is but I can't find any that match the description, other than
> the regular libraries (plib3r.lib ? etc.)

Hmmm ... well you have to set WATCOM=C:\WATCOM (or wherever you installed
it) though it is likely you have that set up correctly.  If so then you
can mail me your %WATCOM%\BIN\WLINK.LNK and %WATCOM%\BINB\WLSYSTEM.LNK
files.  They may turn up a clue or two.

--
Paul Hsieh

Graphics Programmer
Chromatic Research

What I say and what my company says are not always the same thing

 
 
 

Watcom DOS4GW Probs

Post by Ian G » Wed, 15 May 1996 04:00:00




Quote:>Hello! I just got Watcom C and am wondering how I can make this DOS4GW
>thing work.
>Hmm--by reading the on-line documentation I see that a simple example
>program is constructed thus:

>#include <stdio.h>

>void main(void) {
>  printf("Hello world.\n");
>}

>okay, simple little C program. Then they give the command-line for the
>compile step:

>wcl386 /l=dos4g hello.c

>well, this is where I have problems. The linker is telling me this:

>WATCOM Linker Version 10.6
>Copyright by WATCOM International Corp. 1985, 1996. All rights
>reserved.
>WATCOM is a trademark of WATCOM International Corp.
>Warning(1107): file __WCL__.LNK: line(2): undefined system name: dos4g
>loading object files
>searching libraries
>Error(3002): ** internal ** - format not decided
>Error: Linker returned a bad status

>Any ideas? Any help would be greatly appreciated.

Try leaving out the /l=dos4g parameter.
Also read the online documentation on the linker, so you understand what all
those .lnk files are for.
 
 
 

Watcom DOS4GW Probs

Post by Gumbyt » Wed, 15 May 1996 04:00:00


Quote:>WATCOM Linker Version 10.6
>Copyright by WATCOM International Corp. 1985, 1996. All rights
>reserved.
>WATCOM is a trademark of WATCOM International Corp.
>Warning(1107): file __WCL__.LNK: line(2): undefined system name: dos4g
>loading object files
>searching libraries
>Error(3002): ** internal ** - format not decided
>Error: Linker returned a bad status

Thanks for all the help! I found the problem after looking at the docs
for the .lnk files as suggested by Ian. Turns out all I had to do was
copy the .lnk files (wlink.lnk and wlsystem.lnk as stated by Mr.
Hsieh) to my compilation directory. Also needed to copy wstub.exe for
the startup code for DOS/4GW but the compiler tells you that.
Again thanks and hopefully this helps out other people too.

-=Gumbytwo=-

 "This content in no way reflects the opinions, standards, or policy of
 the United States Air Force Academy or the United States government."
+-------------------------------------------------------------+

"Kill a man, you're a *er; Kill many, you're a conqueror;
 Kill them all, you're a God." -- MEGADETH       Commodore 64!

 
 
 

Watcom DOS4GW Probs

Post by Paul Hsie » Wed, 15 May 1996 04:00:00



> >WATCOM Linker Version 10.6
> >Copyright by WATCOM International Corp. 1985, 1996. All rights
> >reserved.
> >WATCOM is a trademark of WATCOM International Corp.
> >Warning(1107): file __WCL__.LNK: line(2): undefined system name: dos4g
> >loading object files
> >searching libraries
> >Error(3002): ** internal ** - format not decided
> >Error: Linker returned a bad status

> Thanks for all the help! I found the problem after looking at the docs
> for the .lnk files as suggested by Ian. Turns out all I had to do was
> copy the .lnk files (wlink.lnk and wlsystem.lnk as stated by Mr.
> Hsieh) to my compilation directory.

Doh!  You don't go copying the *.lnk files to your directory.  Simply:
"set WATCOM=C:\WATCOM" and "set INCLUDE=%WATCOM%\H" should be enough to
do it.x

Quote:> [...] Also needed to copy wstub.exe for
> the startup code for DOS/4GW but the compiler tells you that.
> Again thanks and hopefully this helps out other people too.

*Ouch*  Seriously, you are not supposed to move your compiler components
around.   You just need to set up your environment variables.

--
Paul Hsieh

Graphics Programmer
Chromatic Research

What I say and what my company says are not always the same thing

 
 
 

Watcom DOS4GW Probs

Post by Gumbyt » Thu, 16 May 1996 04:00:00


Quote:>Doh!  You don't go copying the *.lnk files to your directory.  Simply:
>"set WATCOM=C:\WATCOM" and "set INCLUDE=%WATCOM%\H" should be enough to
>do it.x

Umm...
I do have the EDPATH, INCLUDE and WATCOM env. vars set...
Any reason why it wasn't working?
Even using /i=d:\watcom\h doesn't work...

-=Gumbytwo=-

"This content in no way reflects the opinions, standards, or policy of
the United States Air Force Academy or the United States government."
+------------------------------------------------------------+

"Kill a man, you're a *er; Kill many, you're a conqueror;
 Kill them all, you're a God." -- MEGADETH       Commodore 64!

 
 
 

Watcom DOS4GW Probs

Post by DUCROQUET Erw » Thu, 16 May 1996 04:00:00


For your problem with printf :
 WATCOM acts as an UNIX compiler concerning tty output.
 This tty output are bufferized, that means that,in fact,  it will
 actually prints on the screen only when the '\n' character arrives
 in the buffer.
 In your programm , the printf("%s") write only in the tty buffer.
 When you type <Enter>, the while ends , and you call printf("\n..");
 , the first character you printf is '\n', it will make the precedent
 printf appear on the screen.
 If you want to see step by step the characters you type, you have
 to make a printf("%s\n");
 BORLANDC, which is close to PC and as nothing to do with UNIX
 doesn't use a tty buffer for is tty output.
 If you don't want a line feed at each step, you must
 forget printf and use the graphics fonctions of WATCOM.

 The getch() fonction isn't a C standard fonction and use no
 tty buffer as printf and scanf, it is a fonction close to PC.
 When you type a "special" key as an arrow, getch() first returns
 0 , you have to call it a second time to obtain the number of this
 key.

 A little advice : use the control characters as '\0' and '\n'
 instead of direct values .

                                        I hope this will help you.

                                        Erwan Ducroquet
                                        Paris, France.

/******************************/
/** Still searching a banner **/
/******************************/

 
 
 

Watcom DOS4GW Probs

Post by Joel L Duerks » Thu, 16 May 1996 04:00:00




> For your problem with printf :
>  WATCOM acts as an UNIX compiler concerning tty output.
>  This tty output are bufferized, that means that,in fact,  it will
>  actually prints on the screen only when the '\n' character arrives
>  in the buffer.

I thought the correct way was to use flush, even the '\n'
may not cause output (implementation dependent I believe)
 
 
 

Watcom DOS4GW Probs

Post by Zaitcev Pave » Fri, 17 May 1996 04:00:00


Hi!
I have read my PC intern , and it says that none of the stdlib,stdio will work
with 32-bit extenders, just because they written for 16-bit.
.....
You welcome.
Pavel.
---
FEAR-false evidance approves real

(604)595-7289
(604)595-0948 ask for Pavel...
:-)

 
 
 

Watcom DOS4GW Probs

Post by DUCROQUET Erw » Sat, 18 May 1996 04:00:00


Answers to Zaitcev Pavel & Gumbytwo :

1)


>I have read my PC intern , and it says that none of the stdlib,stdio will work
>with 32-bit extenders, just because they written for 16-bit.

Don't think so.
If you compile your standard C code with a 32bits compiler,whatever it is,
it will use is 32bits library containing 32bits code and generate a 32bits
executable.
An ANSI-C programme using only stdlib and stdio will perfectly compile
on everey compiler of every system , 8bits,16bits,32bits,64bits,1024bits etc...
It's the compiler's job to make your C-source works on your system.

If you was thinking of the 16bits DOS and BIOS interrupts, the DOS-Extender
provides an interface between 32bits and 16bits code.The least you call
16bits codes in your 32bits prog. the best it will works.

2) For Gumbytwo:
If you want to use WATCOM only under DOS, you will discovers that it is
very different from using a Borland compiler : WATCOM provides no IDE
for DOS.
You'll have to use Environnement Variables and command lines executables.
I've made a little BAT file that i call before i use WATCOM , it set the
environnements variables that WATCOM will use :
        SET PATH=%PATH%;C:\WATCOM\BINW
        SET WATCOM=C:\WATCOM
        SET INCLUDE=C:\WATCOM\H
        SET LIB=C:\WATCOM\LIB386
        SET LIBDOS=C:\WATCOM\LIB386;C:\WATCOM\LIB386\DOS
        SET TMP=C:\DOS\TEMP
Another BAT for compile and link:
        wcl386 /zq /we /3r /s /l=dos4g %1
And use makefile for "big" project:
        CC=wcc386 /zq /we /3r /s
        AS=wasm
        LD=wlink system dos4g option quiet
        LB=wlib -q -d

I recommend you to carefuly read the doc, or use WHELP if you don't have the
books.

                                                Hope this will help.
                                                        Erwan Ducroquet

 
 
 

1. Mouse prob with DOS4GW & Watcom

I wrote a small function to poll the mouse driver for the current mouse
possition. Nothing special:

void UpdateMouse(void)
        {
        static union REGS r;

        r.x.eax = 0x03;
        int386(0x33, &r, &r);
        MouseX = r.x.ecx >> 1;
        MouseY = r.x.edx;
        Buttons = r.x.ebx;
        }

I compile it with Watcom C 9.5, and it runs under Rational DOS4GW 1.95
The strange thing is that it works fine in the Windows 3.1 Dos shell.
However, when I run it in real dos, the values are wild and
unpredictable.  There is a working mouse driver in dos, since I can play
other games and the mouse works fine.  Does anyone have any suggestions?


Thanks!!

2. How to convert 2IMG roms back to the IIGS

3. TV 2.0 Ported to Watcom 10.0a(dos4gw)

4. Help needed on increasing INDEXF.SYS

5. looking for Watcom C, DOS4GW real mode interrupt handler example

6. Sparc Clone

7. DOS4GW/Watcom c++ questions

8. AC Charger adaptor

9. Accessing a PCI card using Watcom/DOS4GW under DOS

10. Watcom DOS4GW

11. Watcom 10.6 DOS4GW debugging under NT - Help!

12. Watcom / DOS4GW - Page Faults

13. Watcom with DOS4GW support overlays?