Hello,
Long time ago...
On Sat, 13 Sep 2003 22:17:36 -0500, you wrote:
>I am initially interested in using the provided DLL, which is used by =
the
>pop11.exe. I am digging into the sources to try to figure out how =
pop11.exe
>utilizes the DLL but my lack of C knowledge is catching up with me.
You can use the DLL from a program, but it's not very useful:
program TestDelphi;
{$APPTYPE CONSOLE}
uses
Windows;
function pop_start(bMainThread:BOOL; exitCode:PUINT):BOOL; cdecl;
external 'poplog.dll';
begin
pop_start(True, @exitCode);
end.=20
This is a direct translation of the pop11.exe source code. The problem
is that the exe is just a wrapper for the DLL. Once called, the DLL
takes over and the program. This document:
http://www.cs.bham.ac.uk/research/poplog/sysdoc/nt
explains that the reason of using a DLL is just to make easier certain
Poplog callback mechanism.=20
I would suggest to use a Poplog exe from Delphi using standard input
and output. It will be as fast as using the dll.=20
I've had problems to make Windows Poplog to be externally controlled
this way using standard procedures, surely because I still know little
about Pop11. I had to use a code similar to this at the top level:
-------------------------
define read_string() -> some_string;
lvars some_string =3D '';
lvars stdin =3D popdevin;=20
lvars car =3D ' ';
repeat forever
if sysread(stdin, car, 1) =3D 1 then
if car(1) =3D 13 then
quitloop;
endif;
if car(1) =3D 10 then
quitloop;
endif;
some_string >< car -> some_string;
;;;security while debugging:
if length(some_string) > 15 then
quitloop;
endif;
endif;
endrepeat;
enddefine;
vars temp;
vars stdout =3D popdevout;
repeat forever
read_string() -> temp;
if temp =3D 'quit' then
quitloop;
endif;
pr(temp >< '\r\n');
sysflush(stdout, true);
endrepeat;
-------------------------
Of course this was only a test. I guess you will want to call
syscompile() instead of echoing the input.
Another question is how to control a external program from Delphi.
It's not as easy as it would appear. I've made a little component and
a test project using the Windows command interpreter, and uploaded it
to:
http://espira.net/poplog/delphi_pipe.zip
Hope it helps.
--
saludos,
=20
Nico Arag=F3n
NOTE: na-list address only works for messages coming from lists.
Please, write to "nico" at the same domain for direct email.
|