May 07, 2009
I try to build DOS 32-bit extender programs, I'm able to build it (using dmc -mx), but if I try to run the program, it always fails with the GUI message box "The ntvdm cpu has encountered an illegal instruction". Maybe I'm missing something clearly obvious, but I cannot figure how to get it work.

Maybe the problem could be connected with the OPTLINK warning that I always become:

link
obj\test\Except,obj\test\Except.exe,,cppfw+x32+user32+kernel32/noi/nologo/nomap;
OPTLINK (R) for Win32  Release 8.00.1
Copyright (C) Digital Mars 1989-2004  All rights reserved.
OPTLINK : Warning 148: USE16/USE32 Mismatch : DGROUP

maybe it is because the libs user32+kernel32 are added to the command line, but I don't know how to get rid of these libs (I don't use the optlink directly, but through calling dmc, because of different syntax of the optlink command line which is not compatible with the makefile system I use), even tried with the option dmc -L/exetype:DOS or DOS4 with no luck (user32+kernel32 still present on the command line and the program is failing).

But I'm able to build and normally run the DOS-16 programs (dmc -mm) without problems, even when the user32+kernel32 is still present on the optlink command line
May 12, 2009
Hello,

Emil Maskovsky wrote...
> I try to build DOS 32-bit extender programs, I'm able to build it (using dmc -mx), but if I try to run the program, it always fails with the GUI message box "The ntvdm cpu has encountered an illegal instruction". Maybe I'm missing something clearly obvious, but I cannot figure how to get it work.

Try to compile a simple "Hello World" program with dmc. Mybe you get the
same error message I get:
  D:\TEMP>dmc -mx hello.c
  link cx+hello,hello/noi;
  OPTLINK (R) for Win32  Release 8.00.1
  Copyright (C) Digital Mars 1989-2004  All rights reserved.
  cx.obj
   Error 2: File Not Found cx.obj

  --- errorlevel 1

The CX.OBJ file is missing here. I don't have it in the dm\lib path
anymore because I use the external library from
  http://www.dosextender.com/


> Maybe the problem could be connected with the OPTLINK warning that I always become:
> 
> link
> obj\test\Except,obj\test\Except.exe,,cppfw+x32+user32+kernel32/noi/nologo/nomap;
> OPTLINK (R) for Win32  Release 8.00.1
> Copyright (C) Digital Mars 1989-2004  All rights reserved.
> OPTLINK : Warning 148: USE16/USE32 Mismatch : DGROUP
> 
> maybe it is because the libs user32+kernel32 are added to the command line

X32 and the windows libs user32 and kernel32 should not be mixed. If you
use the -mx switch with dmc no windows libs are passed to the linker. If
you want to call the linker yourself the line should look like this:
  link CX+hello,hello.exe,,X32/noi;

CX and X32 must be in the found in the dm\lib or in a directory that is specified in the environment variable LIB


> but I don't know how to get rid of these libs (I don't use the optlink directly, but through calling dmc, because of different syntax of the optlink command line which is not compatible with the makefile system I use), even tried with the option dmc -L/exetype:DOS or DOS4 with no luck (user32+kernel32 still present on the command line and the program is failing).

dmc command line should not add windows libs when the switch -mx is used as memory model switch.


> 
> But I'm able to build and normally run the DOS-16 programs (dmc -mm) without problems, even when the user32+kernel32 is still present on the optlink command line

As long as there is no reference to a symbol in the windows libs they will be ignored.


- Heinz