[fpc-pascal] OS/2 and fcl-base\syncobjs
waldo kitty
wkitty42 at windstream.net
Mon Nov 12 18:28:45 CET 2012
is fcl-base\syncobjs not ready for use with OS/2? i'm trying to work with
synapse40... it doesn't have any IFDEFs for OS/2 which i'm sure are or will be
needed... the release version of fpc 2.6.0 does not have syncobjs in the
units/OS2/fcl-base directory...
/me is stuck... again :/
[compile output]
4OS2-2.51 (0) | X:\fpc\projects\test >fpc -FuX:\fpc\libs\synapse40\source\lib
test.lpr
Free Pascal Compiler version 2.6.0 [2011/12/26] for i386
Copyright (c) 1993-2011 by Florian Klaempfl and others
Target OS: OS/2
Compiling test.lpr
Compiling X:\FPC\LIBS\SYNAPSE40\SOURCE\LIB\synacode.pas
Assembling synacode
Compiling X:\FPC\LIBS\SYNAPSE40\SOURCE\LIB\ssl_openssl.pas
Compiling X:\FPC\LIBS\SYNAPSE40\SOURCE\LIB\blcksock.pas
Compiling X:\FPC\LIBS\SYNAPSE40\SOURCE\LIB\synafpc.pas
Assembling synafpc
Compiling X:\FPC\LIBS\SYNAPSE40\SOURCE\LIB\synsock.pas
Fatal: Can't find unit SyncObjs used by synsock
Fatal: Compilation aborted
Error: X:\FP\2.6.0\BIN\OS2\ppc386.exe returned an error exitcode (normal if you
did not specify a source file to be compiled)
[/compile output]
[test.lpr source code]
program test;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Classes,
{ you can add units after this }
SysUtils, synacode, ssl_openssl, httpsend; //using the openssl plugin unit
Const
myKeepAlive = False;
MaxURLFields = 4;
URLFields : array[1..MaxURLFields] of String =
('var1','var2','var3','var4');
URLValues : array[1..MaxURLFields] of String =
('val1','val2','val3','val4');
//myURL : string = 'http://test.server.invalid/cgi-bin/posttest.cgi';
myURL : string = 'https://test.server.invalid/cgi-bin/login.cgi';
myUserAgent : string = 'Mozilla/5.0 (myAgent built with synapse40)';
myHTTPProtVer : string = '1.1';
var
myClient : THTTPSend;
myList : TStringList;
myCounter : integer;
myURLElements : String;
begin
myClient := THTTPSend.Create;
myList := TStringList.Create;
myClient.UserAgent := myUserAgent;
myClient.Protocol := myHTTPProtVer;
myClient.KeepAlive := myKeepAlive;
myURLElements := '';
for myCounter := 1 to MaxURLFields do
begin
myURLElements := myURLElements + URLFields[myCounter] + '=' +
EncodeURLElement(URLValues[myCounter]);
if myCounter < MaxURLFields then
myURLElements := myURLElements + '&';
end;
try
myClient.Document.Write(Pointer(myURLElements)^, Length(myURLElements));
myClient.MimeType := 'application/x-www-form-urlencoded';
if not myClient.HTTPMethod('POST', myURL) then
begin
writeln('ERROR');
writeln(myClient.Resultcode);
end
else
begin
write(myURL, ' - ');
writeln(myClient.Resultcode, ' ', myClient.Resultstring);
writeln;
writeln(myClient.headers.text);
writeln;
myList.loadfromstream(myClient.Document);
writeln(myList.text);
end;
finally
myClient.Free;
myList.free;
end;
end.
[/test.lpr source code]
More information about the fpc-pascal
mailing list