Connecting Tech Pros Worldwide Forums | Help | Site Map

how to build plain-dos EXE using Borland C++ 3.1 which uses WINAPI

Przemysław Dmochowski
Guest
 
Posts: n/a
#1: Jul 22 '05
Please help me.

I need to use some of Windows API, but my program must be also runnable from
plain dos.

I can not simply switch target to Win app. :(

Question: how link program witch <windows.h> included, but with plain DOS
startup code?

My program should detect if is running under windows and then use some of
API calls.


--

pozdrawiam / best regards
B.a.z.i.c * a.t * b.a.z.i.c * d.o.t * p.l




Jarmo
Guest
 
Posts: n/a
#2: Jul 22 '05

re: how to build plain-dos EXE using Borland C++ 3.1 which uses WINAPI


"Przemysław Dmochowski" <bazic@bazic.not.exist.pl> wrote in message
news:btueaj$dj$1@nemesis.news.tpi.pl...[color=blue]
> Please help me.
>
> I need to use some of Windows API, but my program must be also runnable[/color]
from[color=blue]
> plain dos.
>
> I can not simply switch target to Win app. :(
>
> Question: how link program witch <windows.h> included, but with plain DOS
> startup code?
>
> My program should detect if is running under windows and then use some of
> API calls.
>
>
> --
>
> pozdrawiam / best regards
> B.a.z.i.c * a.t * b.a.z.i.c * d.o.t * p.l[/color]

I'd build two versions of the program, one for DOS and one for Windows.
Then build a third program that execs on of the other two depending on the
OS.

PS you're asking in the wrong newsgroup.


Walter
Guest
 
Posts: n/a
#3: Jul 22 '05

re: how to build plain-dos EXE using Borland C++ 3.1 which uses WINAPI



"Przemysław Dmochowski" <bazic@bazic.not.exist.pl> wrote in message
news:btueaj$dj$1@nemesis.news.tpi.pl...[color=blue]
> I need to use some of Windows API, but my program must be also runnable[/color]
from[color=blue]
> plain dos.[/color]

Build a dos version, then a windows version. When linking the windows
version, use the dos version as the "stub executable". Then, even though the
result is only one big executable file, the dos version will run when in
dos, and the windows version will run when run under windows. This even
works when the dos version is a 32 bit dos extended version. I used to do
this all the time, it works great.

-Walter
www.digitalmars.com free C/C++/D compilers


Closed Thread