Thread overview
Re: dos.h _dos_findfirst example
Nov 15, 2001
Vic Dura
Nov 15, 2001
Jan Knepper
Nov 16, 2001
Vic Dura
November 15, 2001
On Thu, 15 Nov 2001 03:26:48 -0500, Jan Knepper <jan@smartsoft.cc> wrote:

>Yep!
>You're missing SDL.LIB... That's why you get the errors.
>Which .LIB files do you have???

Jan,

Here are the libs that came with the Digital Mars C/C++ Compiler Version 8.23 (2,765,000 bytes) package:

ADVAPI32.LIB    53760   8/08/96  19:30 COMCTL32.LIB     9728   6/24/01  16:41 COMDLG32.LIB     3072   8/08/96  19:30 CTL3D32.LIB      2560  12/04/95   8:07 gc.lib          11776   6/19/01  15:10 GDI32.LIB       35328   8/08/96  19:30 KERNEL32.LIB    79872   8/08/96  19:30 OLE32.LIB       32256   8/08/96  19:30 OLEAUT32.LIB    24064   8/14/96   5:24 snn.lib        527872  10/24/01   9:37 USER32.LIB      60416   8/08/96  19:30 UUID.LIB       170496   8/14/96   5:24


>I will attach my SDL.LIB, but really the best thing to do is post these messages in the newsgroup so Walter can read and reply to them as well.

Ooops! I thought I was posting to the NG. My "post reply to NG" and "post reply via email" buttons are next to each other. I've been meaning to move them further apart.

Anyway, thank you. That solved the "Warning 2: File Not Found SDL.lib" error. Does it look like I now have all the LIBs?

Also, do you happen to know which RTL functions replace _dos_findfirst or _dos_findnext in win32 programs? That's what I'm trying to do, convert a small MS DOS v6.0 C program to a win32 console application. For some reason, I'm having a difficult time finding function descriptions in the RTL docs.

That leads me to another question.

The documentation at the DM site says under "Building Console Applications" that to compile console applications, use the -mn compiler option, and specify the SUBSYSTEM CONSOLE directive in the .def file.

I've read the section about .def files, in the Compiler Tool Guide, but didn't see a directive SUBSYSTEM CONSOLE, and didn't see any information about where a .def file should be located, how it is named, and how to tell the linker about it. Could you point me in the right directions?

Thanks again for your help and the SDL.lib.

Regards,
Vic Dura


>Vic Dura wrote:
>
>> On Wed, 14 Nov 2001 13:06:38 -0500, in c++.dos.32-bits you wrote:
>>
>> >You will have to compile with
>> >sc -ml ffirst.c
>> >Or other compiler flags that generate a DOS executable.
>> >sc now by default generates a Win32 executable. Win32 does not have
>> >_dos_findfirst or _dos_findnext.
>>
>> Thank you Jan for your suggestion. I tried "sc -ml -v2 ffirst.c" but it didn't help. I got the following:
>>
>> ========== begin command output ===========
>>
>> scppn -ml -v2 ffirst.c
>> Digital Mars C/C++ Compiler Version 8.22n
>> Copyright (C) Digital Mars 2000-2001.  All Rights Reserved.
>> Written by Walter Bright
>> www.digitalmars.com
>>  'ffirst.c'
>>   'E:\DM\BIN\..\include\dos.h'
>>   'E:\DM\BIN\..\include\stdio.h'
>>   'E:\DM\BIN\..\include\stdlib.h'
>>    'E:\DM\BIN\..\include\heapstat.h'
>> list_name
>> main
>> C/C++ Compiler complete. Code: 0x00a1 (161) Data: 0x002c (44) Time:
>> 0.13 seconds
>>
>> link ffirst/noi;
>> OPTLINK (R) for Win32  Release 7.50B1
>> Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved
>>
>> SDL.lib
>>  Warning 2: File Not Found SDL.lib
>> OPTLINK : Warning 23: No Stack
>> ffirst.obj(ffirst)
>>  Error 42: Symbol Undefined __acrtused
>> ffirst.obj(ffirst)
>>  Error 42: Symbol Undefined _printf
>> ffirst.obj(ffirst)
>>  Error 42: Symbol Undefined __dos_findfirst
>> ffirst.obj(ffirst)
>>  Error 42: Symbol Undefined __dos_findnext
>> OPTLINK : Warning 134: No Start Address
>>
>> --- errorlevel 4
>>
>> ============= end command output ===========
>>
>> It looks like I'm also missing something called SDL.lib? Do you happend to know if that should have been part of  the DM822C.ZIP package available from www.digitalmars.com ?

November 15, 2001
> Also, do you happen to know which RTL functions replace _dos_findfirst or _dos_findnext in win32 programs? That's what I'm trying to do, convert a small MS DOS v6.0 C program to a win32 console application.

FindFirstFile and FileNextFile:

   HANDLE             handle;
   WIN32_FIND_DATA   *win32_find_data  = new  WIN32_FIND_DATA;
   BOOL               result;
   int                pathsize         = strlen ( path );

   // Process the file's in this directory following the 'wildcard'.

   handle = FindFirst ( win32_find_data );
   if ( handle != INVALID_HANDLE_VALUE )
   {
      do
      {
         if ( Canceled () )
            break;

         // Do something

         result = FindNext ( handle, win32_find_data );
      }
      while ( result );

      FindClose ( handle );
   }


> The documentation at the DM site says under "Building Console Applications" that to compile console applications, use the -mn compiler option, and specify the SUBSYSTEM CONSOLE directive in the .def file.

TEST.DEF:

NAME            'TEST' WINDOWAP

DESCRIPTION     'TEST'

EXETYPE         NT

SUBSYSTEM       CONSOLE

STUB            'WINSTUB.EXE'

CODE             EXECUTE READ

DATA             READ WRITE

STACKSIZE       1048576,4096

HEAPSIZE        1048576,4096



TEST.LNK:
TEST.OBJ+
One.OBJ+
Two.OBJ+
Three.OBJ
TEST.EXE
NUL
KERNEL32.LIB GDI32.LIB USER32.LIB
TEST.DEF;


Link:
link @test.lnk

> I've read the section about .def files, in the Compiler Tool Guide, but didn't see a directive SUBSYSTEM CONSOLE, and didn't see any information about where a .def file should be located, how it is named, and how to tell the linker about it. Could you point me in the right directions?

Hope the stuff above helps.

Jan


November 16, 2001
On Thu, 15 Nov 2001 17:26:08 -0500, Jan Knepper <jan@smartsoft.cc> wrote:

>Hope the stuff above helps.

I think it will help a great deal. I'll study it closely and try to learn from it.

Thanks for your help.

Regards,
Vic Dura