Mail Archives: djgpp/1995/08/16/23:14:33
Hello fellow DJGPP'ers,
While I was trying to sleep last night I began to think about how you could use the
windows API from DJGPP DPMI programs in either windows or win 95. Here's The idea I came
up with.
NOTE: I have no experience whatsoever in progamming under windows, so this is just a
guess at how someone could attempt it.
The main problem seems to be cludging up an interface (in asm) and therefore getting your
program to call the API by c wrappers which call the windows functions. This method
would produce a lot of asm code, lots of work, and probably need quite a bit of
reverse engineering/undocumented stuff to work.
However, there are (commercial) windows compilers out there that already have this
functionality built in - they can call any API function they want. If our DJGPP
programs could tap that functionality, then they could use the API.
So why not set up a program (using a commercial windows compiler) that acts as a server,
recieving messages about API calls and managing them for a client program?
One way of implementing this would be:
The windows compiled program boots the DJGPP image as a dos box process. They
communicate through some interrupt mechanism. When the DJGPP program wants to call the API,
it calls a c wrapper which triggers the interrupt (with a code for the API call), and
waits for a signal that indicates the API call was succesful. The windows program opens
and manages windows for the DJGPP program, giving the illusion that the DJGPP program is
in control of the window.
All this requires to work is a way of sharing a small part of memory space between the
programs so that signals/parameters may be passed in it. If you wanted to get really
technical, you could make the windows server handle more than one DJGPP process at a time,
by requiring all programs to "register" themselves to the server, and using a unique ID
number (which was passed back) to indicate which DJGPP process required which services.
This method would be slower than standard windows programs but might work under NT and
95. As soon as DJGPP can produce windows programs with API functionality, my
prediction is that it will rapidly become the most popular dos/windows compiler.
Thoughts? Ideas? Comments? Problems?
Looking forward to your replies...
Jon.
(jpg AT cs DOT waikato DOT ac DOT nz)
- Raw text -