On 9 Mar 00, at 11:15, Mark Taylor wrote:
I tried converting this win32 hello.c program to pascal without success...
[...]
You need to import the WinAPI functions before you can call them. e.g., {$define WINAPI(X) asmname X; attribute(stdcall)}
FUNCTION GetModuleHandle ( lpModuleName : PChar ) : Integer; WINAPI ( 'GetModuleHandleA' );
This involves translating the C headers into Pascal. I have been working for more than a year on some units to import whole chunks of the WinAPI (e.g., messages, wintypes, and winprocs) - but of course I don't have too much free time, so the work is progressing slowly. Having said that, more than 80% of the API has already been converted (I wrote a little program to help automate some of the work), although I have not tested and cannot test everything. For precompiled versions of these units, get the file; ftp://agnes.dida.physik.uni-essen.de/home/chief/units.zip and extract wintypes.*, winprocs.* and messages.* from it. Put them in a directory that is accessible to the GPC compiler (preferably the 'units' subdirectory), and then you can do something like this;
program hello; uses messages, wintypes, winprocs; begin MessageBox (0, 'Hello World.', 'Greetings', mb_ok); end.
BTW: if anyone is willing to help in completing work on these units, then just drop me a line.
[...]
To compile I did...
gpc -mno_cygwin -mwindows whello.pas -o whello.exe
You mean '-mno-cygwin'.
Best regards, The Chief ----- Dr Abimbola A Olowofoyeku (The African Chief) Email: African_Chief@bigfoot.com Author of Chief's Installer Pro v5.22 for Win32 http://www.bigfoot.com/~African_Chief/chief32.htm