Re: [fpc-pascal] Win64 release of FPC 2.6.2 missing

2013-05-04 Thread Graeme Geldenhuys
Hi,

John Lee made the suggestion that an unofficial 64-bit Windows
compiler archive be made available - for those people like me.

You can now download it from the Free Pascal FTP site:

  ftp://ftp.freepascal.org/fpc/dist/2.6.2/x86_64-win/


[ readme.txt ]--
64 bit win fpc 2.6.2

generated by Graeme Geldenhuys, uploaded by John Lee
fpc.cfg is set up for Graeme's config

NB this version is not generated as part of the distribution
by the fpc developers since it is not believed to offer any/many
advantages cf the win32 version frunning on a win 64 bit target.

May 2013



Hope somebody finds it useful.


Regards,
  - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] How to detect if a project is a simple program or a application?

2013-05-04 Thread João Marcelo Vaz
Hi Silvio,

I'm trying to detect if a project is a simple program or a application.
 Please download a small test here:

 https://www.dropbox.com/s/w6a9gb4b9hnjit5/prova.zip

 On Windows it works fine, but on Linux not.


This behavior was discussed on this thread:

http://www.mail-archive.com/lazarus@lists.lazarus.freepascal.org/msg37231.html

-- 
João Marcelo
http://blog.caixadepandora.com/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] How to close TInetServer without except?

2013-05-04 Thread Zaher Dirkey
On Sat, May 4, 2013 at 8:47 AM, silvioprog silviop...@gmail.com wrote:

 repeat
   if Socket.CanRead(timeout) then
 begin
 insock:=Socket.Accept;
 if insock-1 then
   //start working with insock
 else
   //deal with error
 end;
 until ThreadTerminated;

 Ludo


 Thank you!


​If you success, tell us, i must fix my sockets too :)​



-- 
I am using last revision of Lazarus, FPC 2.6 on Windows XP SP3

Best Regards
Zaher Dirkey
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

[fpc-pascal] Porting C variable declaration

2013-05-04 Thread Darius Blaszyk


Hi, 

I came across a pointer variable in C which also get's assigned integer
values. Anyone has an idea how to port this in FPC? 

The variable is declared as: 

static void *x=0; 
Later on it get's assigned as this: x= 1; 

Regards, Darius ___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Porting C variable declaration

2013-05-04 Thread Jonas Maebe

On 04 May 2013, at 10:25, Darius Blaszyk wrote:

 I came across a pointer variable in C which also get's assigned integer
 values. Anyone has an idea how to port this in FPC? 
 
 The variable is declared as: 
 
 static void *x=0; 
 Later on it get's assigned as this: x= 1; 

var
  x: pointer;
begin
  x:=nil; { 0 is guaranteed to map to NULL/nil in C }
  x:=pointer(1);
end.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] Compileability of target WinCE restored

2013-05-04 Thread Sven Barth

Hello together!

I've now restored the possiblity to compile arm-wince and i386-wince in 
revision 24420. Sorry for the long time of broken compilation and the 
resulting inconvenience. I'm planning to setup automated test suite runs 
for arm-wince to avoid such problems in the future.


Regards,
Sven
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Compileability of target WinCE restored

2013-05-04 Thread Zaher Dirkey
Did tried my modification in the bug tracker?


On Sat, May 4, 2013 at 2:09 PM, Sven Barth pascaldra...@googlemail.comwrote:

 Hello together!

 I've now restored the possiblity to compile arm-wince and i386-wince in
 revision 24420. Sorry for the long time of broken compilation and the
 resulting inconvenience. I'm planning to setup automated test suite runs
 for arm-wince to avoid such problems in the future.

 Regards,
 Sven
 __**_
 fpc-pascal maillist  -  
 fpc-pascal@lists.freepascal.**orgfpc-pascal@lists.freepascal.org
 http://lists.freepascal.org/**mailman/listinfo/fpc-pascalhttp://lists.freepascal.org/mailman/listinfo/fpc-pascal




-- 
I am using last revision of Lazarus, FPC 2.6 on Windows XP SP3

Best Regards
Zaher Dirkey
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

[fpc-pascal] fpc does not invoke correct compiler

2013-05-04 Thread denisgolovan
Hi all

I experience inconsistency using fpc wrapper. 
See below.

When I invoke fpc using command line fpc -Px86_64 ... it correctly executes 
cross-compiler (ppcrossx64) under Linux 32 bit.
But if I try to push -Px86_64 into a separate file (opts.cfg) and run with fpc 
@opts.cfg it just executes native ppc386.

It looks like a bug to me.

 -- 
Regards,
Denis Golovan
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Win64 release of FPC 2.6.2 missing

2013-05-04 Thread Andrew Brunner
I wanted to mention that Lazarus comes with a 64bit FPC 2.6.2 from binaries...

Guys, Graeme is well meaning here.  I agree that most of us first go to x64 
downloads for binaries.  Thinking 32 to 64 or reverse is onerous on typical end 
users.  

I need 64bit FPC binaries too.   Presently I install the Lazarus to get 64bit 
FPC, then checkout svn FPC/trunk and Lazarus/trunk.  I do this every time 
because of the fact that there is no 64bit FPC.

Others do this too.   You are looking at this too much from the internals.  
This is a case where the Customer is right I can assure you.

But the solution must conform to FPC standards with regards to builds/packaging.

Thanks for any help in offering a 64bit download of FPC.  

Andrew Brunner,

Aurawin LLC
512.574.6298
http://aurawin.com/

Aurawin is great new way to store and share your pictures, videos, and more, 
featuring our innovative Pure Cloud social computing platform. 

On May 3, 2013, at 4:21 PM, Graeme Geldenhuys gra...@geldenhuys.co.uk wrote:

 Hi,
 
 John Lee made the suggestion that an unofficial 64-bit Windows
 compiler archive be made available - for those people like me.
 
 You can now download it from the Free Pascal FTP site:
 
  ftp://ftp.freepascal.org/fpc/dist/2.6.2/x86_64-win/
 
 
 [ readme.txt ]--
 64 bit win fpc 2.6.2
 
 generated by Graeme Geldenhuys, uploaded by John Lee
 fpc.cfg is set up for Graeme's config
 
 NB this version is not generated as part of the distribution
 by the fpc developers since it is not believed to offer any/many
 advantages cf the win32 version frunning on a win 64 bit target.
 
 May 2013
 
 
 
 Hope somebody finds it useful.
 
 
 Regards,
  - Graeme -
 
 -- 
 fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
 http://fpgui.sourceforge.net/
 
 ___
 fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
 http://lists.freepascal.org/mailman/listinfo/fpc-pascal
 
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] How to close TInetServer without except?

2013-05-04 Thread Zaher Dirkey
On Sat, May 4, 2013 at 8:45 AM, Ludo Brands ludo.bra...@free.fr wrote:

 Take a look at TBlockSocket.InternalCanRead and TBlockSocket.CanRead in
 synapse on how to set up select correctly. Then do something like

 repeat
   if Socket.CanRead(timeout) then
 begin
 insock:=Socket.Accept;
 if insock-1 then
   //start working with insock
 else
   //deal with error
 end;
 until ThreadTerminated;


​I have put Select before Accept and it doesn't work, it blocked forever​
without accepting any connection.
Accept function who block the thread and get new connection.

Best Regards
Zaher Dirkey
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] How to close TInetServer without except?

2013-05-04 Thread Ludo Brands
On 05/04/2013 04:31 PM, Zaher Dirkey wrote:
 
 
 ​I have put Select before Accept and it doesn't work, it blocked forever
 ​ without accepting any connection.
 Accept function who block the thread and get new connection.
 

Can you show the code you use? You tested on Windows, linux, Mac, ...?

Ludo


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] How to close TInetServer without except?

2013-05-04 Thread Zaher Dirkey
On Sat, May 4, 2013 at 5:40 PM, Ludo Brands ludo.bra...@free.fr wrote:

 Can you show the code you use? You tested on Windows, linux, Mac, ...?


​Only on Windows XP

source here
https://sourceforge.net/p/minilib/source/ci/master/tree/socket/source/mnServers.pas
about line 323
i changed it to similar to this, but not committed it

  begin
if Socket.Select(1, slRead) = erNone then
​ --- Blocked here forever​

  aSocket := Socket.Accept
else
  aSocket := nil;
Enter;

​select function here DoSelect line 132
https://sourceforge.net/p/minilib/source/ci/master/tree/socket/source/mnWinSockets.pas
​
I am using last revision of Lazarus, FPC 2.6 on Windows XP SP3

Best Regards
Zaher Dirkey
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] How to close TInetServer without except?

2013-05-04 Thread Zaher Dirkey
But mnServer is works with me for a years, and there is mnHttpServer demo
and it is work fine too without Select before Accept
https://sourceforge.net/p/minilib/source/ci/master/tree/socket/demo/lazarus/


On Sat, May 4, 2013 at 6:05 PM, Zaher Dirkey parm...@gmail.com wrote:


 On Sat, May 4, 2013 at 5:40 PM, Ludo Brands ludo.bra...@free.fr wrote:

 Can you show the code you use? You tested on Windows, linux, Mac, ...?


 ​Only on Windows XP

 source here

 https://sourceforge.net/p/minilib/source/ci/master/tree/socket/source/mnServers.pas
 about line 323
 i changed it to similar to this, but not committed it

   begin
 if Socket.Select(1, slRead) = erNone then
 ​ --- Blocked here forever​

   aSocket := Socket.Accept
 else
   aSocket := nil;
 Enter;

 ​select function here DoSelect line 132

 https://sourceforge.net/p/minilib/source/ci/master/tree/socket/source/mnWinSockets.pas
 ​
 I am using last revision of Lazarus, FPC 2.6 on Windows XP SP3

 Best Regards
 Zaher Dirkey




-- 
I am using last revision of Lazarus, FPC 2.6 on Windows XP SP3

Best Regards
Zaher Dirkey
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Win64 release of FPC 2.6.2 missing

2013-05-04 Thread Marco van de Voort
In our previous episode, Andrew Brunner said:
 Guys, Graeme is well meaning here.  I agree that most of us first go to x64 
 downloads for binaries.  Thinking 32 to 64 or reverse is onerous on typical 
 end users.  
 
 I need 64bit FPC binaries too.   Presently I install the Lazarus to get
 64bit FPC,

For bootstrapping purposes, you can simply get the 64-bit ppcx64
compiler at ftp://freepascal.stack.nl/pub/fpc/dist/2.6.2/bootstrap/ :

ftp://freepascal.stack.nl/pub/fpc/dist/2.6.2/bootstrap/x86_64-win64-ppcx64.zip

A checkout of the fpcbuild repository will give you the necessary binutils.


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] fpc does not invoke correct compiler

2013-05-04 Thread Marco van de Voort
In our previous episode, denisgolovan said:
 I experience inconsistency using fpc wrapper. 
 See below.
 
 When I invoke fpc using command line fpc -Px86_64 ... it correctly executes 
 cross-compiler (ppcrossx64) under Linux 32 bit.
 But if I try to push -Px86_64 into a separate file (opts.cfg) and run with 
 fpc @opts.cfg it just executes native ppc386.
 
 It looks like a bug to me.

It is not. fpc has an handful of own parameters, including -P and -V, and
passes the rest to fpc.

So the mistake is that you put fpc parameters in a config file meant for
ppcarch
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Problems with ImageMagick Win64

2013-05-04 Thread Andrew Brunner

http://bugs.freepascal.org/view.php?id=24346

Can someone please apply patch?  Thanks.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] fpGUI Toolkit v1.0 release for FPC 2.6.2

2013-05-04 Thread Paul Breneman

There is a new i386-win32 release with FPC 2.6.2 and fpGUI 1.0 here:
  http://www.turbocontrol.com/easyfpgui.htm

Hopefully the i386-linux and arm-linux releases will be updated soon.

--
Regards,
Paul Breneman
www.dbReplication.com - VCL database replication components
www.TurboControl.com - Hardware and software development services
- Educational programming project for environment monitoring
- Information on using FreePascal for embedded systems
- Support information for the TurboPower open source libraries
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] How to close TInetServer without except?

2013-05-04 Thread Ludo Brands
On 05/04/2013 05:05 PM, Zaher Dirkey wrote:
 
 On Sat, May 4, 2013 at 5:40 PM, Ludo Brands ludo.bra...@free.fr
 mailto:ludo.bra...@free.fr wrote:
 
 Can you show the code you use? You tested on Windows, linux, Mac, ...?
 
 
 ​Only on Windows XP
 


This is a small test program that works for me on XP and linux:

program testselect;

{$mode objfpc}{$H+}

uses
  Classes,sockets,
  {$ifdef unix}
  unix,baseunix,unixtype
  {$else}
  ctypes,WinSock2
  {$endif}
  ;

CONST
  LISTENPORT=1234;
var
  sock: cint;
  sa,clsa:sockaddr;
  tv:TTimeVal;
  readfds,writefds,exceptfds:tfdset;
  c: Integer;
  res: cint;
  len: tsocklen;
  one: Integer;
begin
  sock:=fpsocket(AF_INET, SOCK_STREAM, 0);
  if sock=-1 then
begin
writeln('socket failed with ',socketerror);
exit;
end;
  one:=1;
  if fpsetsockopt(sock, SOL_SOCKET, SO_REUSEADDR, @one, sizeof(one))=-1 then
begin
writeln('setsockopt failed with ',socketerror);
exit;
end;
  fillchar(sa,sizeof(sa),0);
  sa.sin_port:=htons(LISTENPORT);
  sa.sin_family:=AF_INET;
  sa.sin_addr.s_addr:= INADDR_ANY;
  if fpbind(sock,@sa,sizeof(sa))=-1 then
begin
writeln('bind failed with ',socketerror);
exit;
end;
  if fplisten(sock,10)=-1 then
begin
writeln('listen failed with ',socketerror);
exit;
end;
  c:=1;
  repeat
tv.tv_sec:=1;
tv.tv_usec:=0;
{$ifdef unix}
fpFD_ZERO(readfds);
fpFD_ZERO(writefds);
fpFD_ZERO(exceptfds);
fpFD_SET(sock,readfds);
res:=fpselect(sock+1,@readfds,@writefds,@exceptfds,@tv);
if (res=-1) and (socketerrorESYSEINTR) then
begin
writeln('select failed with ',socketerror);
exit;
end;
if (res0) and (fpFD_ISSET(sock,readfds)0) then
  begin
{$else}
FD_ZERO(readfds);
FD_ZERO(writefds);
FD_ZERO(exceptfds);
FD_SET(sock,readfds);
res:=select(sock+1,@readfds,@writefds,@exceptfds,@tv);
if (res=-1) and (socketerrorWSAEINTR) then
   begin
   writeln('select failed with ',socketerror);
   exit;
   end;
if (res0) and (FD_ISSET(sock,readfds)) then
  begin
{$endif}
  fillchar(clsa,sizeof(clsa),0);
  len:=sizeof(clsa);
  if fpaccept(sock,@clsa,@len)=-1 then
begin
writeln('accept failed with ',socketerror);
exit;
end;
  writeln('connection accepted');
  c:=c+1;
  end;
  until c=2;
  closesocket(sock);

end.

If you run the program and do from a console a
telnet localhost 1234
to connect to the program, it will print 'connection accepted' and close
immediately.

Ludo


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] How to close TInetServer without except?

2013-05-04 Thread silvioprog
2013/5/4 Zaher Dirkey parm...@gmail.com


 On Sat, May 4, 2013 at 8:47 AM, silvioprog silviop...@gmail.com wrote:

 repeat
   if Socket.CanRead(timeout) then
 begin
 insock:=Socket.Accept;
 if insock-1 then
   //start working with insock
 else
   //deal with error
 end;
 until ThreadTerminated;

 Ludo


 Thank you!


 If you success, tell us, i must fix my sockets too :)

 --
 I am using last revision of Lazarus, FPC 2.6 on Windows XP SP3

 Best Regards
 Zaher Dirkey


Yes:

https://bitbucket.org/silvioprog/tcpipcomp/src/945866300819bfe0d9d957c64f301e2ff92682e5/src/tcpipserver.pas?at=master#cl-161

-- 
Silvio Clécio
My public projects - github.com/silvioprog
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re:[fpc-pascal] fpc does not invoke correct compiler

2013-05-04 Thread denisgolovan
Ok, I see.
Thanks for the explanation.

 Regards, Denis Golovan
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] How to close TInetServer without except?

2013-05-04 Thread silvioprog
2013/5/4 Ludo Brands ludo.bra...@free.fr

 On 05/04/2013 05:05 PM, Zaher Dirkey wrote:
 
  On Sat, May 4, 2013 at 5:40 PM, Ludo Brands ludo.bra...@free.fr
  mailto:ludo.bra...@free.fr wrote:
 
  Can you show the code you use? You tested on Windows, linux, Mac,
 ...?
 
 
  Only on Windows XP
 


 This is a small test program that works for me on XP and linux:

 program testselect;

 {$mode objfpc}{$H+}

 uses
   Classes,sockets,
   {$ifdef unix}
   unix,baseunix,unixtype
   {$else}
   ctypes,WinSock2
   {$endif}
   ;

 CONST
   LISTENPORT=1234;
 var
   sock: cint;
   sa,clsa:sockaddr;
   tv:TTimeVal;
   readfds,writefds,exceptfds:tfdset;
   c: Integer;
   res: cint;
   len: tsocklen;
   one: Integer;
 begin
   sock:=fpsocket(AF_INET, SOCK_STREAM, 0);
   if sock=-1 then
 begin
 writeln('socket failed with ',socketerror);
 exit;
 end;
   one:=1;
   if fpsetsockopt(sock, SOL_SOCKET, SO_REUSEADDR, @one, sizeof(one))=-1
 then
 begin
 writeln('setsockopt failed with ',socketerror);
 exit;
 end;
   fillchar(sa,sizeof(sa),0);
   sa.sin_port:=htons(LISTENPORT);
   sa.sin_family:=AF_INET;
   sa.sin_addr.s_addr:= INADDR_ANY;
   if fpbind(sock,@sa,sizeof(sa))=-1 then
 begin
 writeln('bind failed with ',socketerror);
 exit;
 end;
   if fplisten(sock,10)=-1 then
 begin
 writeln('listen failed with ',socketerror);
 exit;
 end;
   c:=1;
   repeat
 tv.tv_sec:=1;
 tv.tv_usec:=0;
 {$ifdef unix}
 fpFD_ZERO(readfds);
 fpFD_ZERO(writefds);
 fpFD_ZERO(exceptfds);
 fpFD_SET(sock,readfds);
 res:=fpselect(sock+1,@readfds,@writefds,@exceptfds,@tv);
 if (res=-1) and (socketerrorESYSEINTR) then
 begin
 writeln('select failed with ',socketerror);
 exit;
 end;
 if (res0) and (fpFD_ISSET(sock,readfds)0) then
   begin
 {$else}
 FD_ZERO(readfds);
 FD_ZERO(writefds);
 FD_ZERO(exceptfds);
 FD_SET(sock,readfds);
 res:=select(sock+1,@readfds,@writefds,@exceptfds,@tv);
 if (res=-1) and (socketerrorWSAEINTR) then
begin
writeln('select failed with ',socketerror);
exit;
end;
 if (res0) and (FD_ISSET(sock,readfds)) then
   begin
 {$endif}
   fillchar(clsa,sizeof(clsa),0);
   len:=sizeof(clsa);
   if fpaccept(sock,@clsa,@len)=-1 then
 begin
 writeln('accept failed with ',socketerror);
 exit;
 end;
   writeln('connection accepted');
   c:=c+1;
   end;
   until c=2;
   closesocket(sock);

 end.

 If you run the program and do from a console a
 telnet localhost 1234
 to connect to the program, it will print 'connection accepted' and close
 immediately.

 Ludo


I think you should make a server and client component and send it to the
Free Pascal team. :)

-- 
Silvio Clécio
My public projects - github.com/silvioprog
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] How to detect if a project is a simple program or a application?

2013-05-04 Thread silvioprog
2013/5/4 João Marcelo Vaz jms...@gmail.com

 Hi Silvio,

 I'm trying to detect if a project is a simple program or a application.
 Please download a small test here:

 https://www.dropbox.com/s/w6a9gb4b9hnjit5/prova.zip

 On Windows it works fine, but on Linux not.


 This behavior was discussed on this thread:


 http://www.mail-archive.com/lazarus@lists.lazarus.freepascal.org/msg37231.html

 --
 João Marcelo
 http://blog.caixadepandora.com/


So I'll add a property Threaded: Boolean on my class.

Thank you!

-- 
Silvio Clécio
My public projects - github.com/silvioprog
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] How to close TInetServer without except?

2013-05-04 Thread Zaher Dirkey
Hmm there is diffrents
Yours
res:=select(sock+1,@readfds,@writefds,@exceptfds,@tv);
Mine
c := WinSock2.select(0, PSetRead, PSetWrite, nil, @TimeVal);

0 here in mine, in yours sock+1 (FHandle+1 in mine).
I will take more testing.


On Sat, May 4, 2013 at 8:01 PM, Ludo Brands ludo.bra...@free.fr wrote:

 On 05/04/2013 05:05 PM, Zaher Dirkey wrote:
 
  On Sat, May 4, 2013 at 5:40 PM, Ludo Brands ludo.bra...@free.fr
  mailto:ludo.bra...@free.fr wrote:
 
  Can you show the code you use? You tested on Windows, linux, Mac,
 ...?
 
 
  ​Only on Windows XP
 


 This is a small test program that works for me on XP and linux:

 program testselect;

 {$mode objfpc}{$H+}

 uses
   Classes,sockets,
   {$ifdef unix}
   unix,baseunix,unixtype
   {$else}
   ctypes,WinSock2
   {$endif}
   ;

 CONST
   LISTENPORT=1234;
 var
   sock: cint;
   sa,clsa:sockaddr;
   tv:TTimeVal;
   readfds,writefds,exceptfds:tfdset;
   c: Integer;
   res: cint;
   len: tsocklen;
   one: Integer;
 begin
   sock:=fpsocket(AF_INET, SOCK_STREAM, 0);
   if sock=-1 then
 begin
 writeln('socket failed with ',socketerror);
 exit;
 end;
   one:=1;
   if fpsetsockopt(sock, SOL_SOCKET, SO_REUSEADDR, @one, sizeof(one))=-1
 then
 begin
 writeln('setsockopt failed with ',socketerror);
 exit;
 end;
   fillchar(sa,sizeof(sa),0);
   sa.sin_port:=htons(LISTENPORT);
   sa.sin_family:=AF_INET;
   sa.sin_addr.s_addr:= INADDR_ANY;
   if fpbind(sock,@sa,sizeof(sa))=-1 then
 begin
 writeln('bind failed with ',socketerror);
 exit;
 end;
   if fplisten(sock,10)=-1 then
 begin
 writeln('listen failed with ',socketerror);
 exit;
 end;
   c:=1;
   repeat
 tv.tv_sec:=1;
 tv.tv_usec:=0;
 {$ifdef unix}
 fpFD_ZERO(readfds);
 fpFD_ZERO(writefds);
 fpFD_ZERO(exceptfds);
 fpFD_SET(sock,readfds);
 res:=fpselect(sock+1,@readfds,@writefds,@exceptfds,@tv);
 if (res=-1) and (socketerrorESYSEINTR) then
 begin
 writeln('select failed with ',socketerror);
 exit;
 end;
 if (res0) and (fpFD_ISSET(sock,readfds)0) then
   begin
 {$else}
 FD_ZERO(readfds);
 FD_ZERO(writefds);
 FD_ZERO(exceptfds);
 FD_SET(sock,readfds);
 res:=select(sock+1,@readfds,@writefds,@exceptfds,@tv);
 if (res=-1) and (socketerrorWSAEINTR) then
begin
writeln('select failed with ',socketerror);
exit;
end;
 if (res0) and (FD_ISSET(sock,readfds)) then
   begin
 {$endif}
   fillchar(clsa,sizeof(clsa),0);
   len:=sizeof(clsa);
   if fpaccept(sock,@clsa,@len)=-1 then
 begin
 writeln('accept failed with ',socketerror);
 exit;
 end;
   writeln('connection accepted');
   c:=c+1;
   end;
   until c=2;
   closesocket(sock);

 end.

 If you run the program and do from a console a
 telnet localhost 1234
 to connect to the program, it will print 'connection accepted' and close
 immediately.

 Ludo


 ___
 fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
 http://lists.freepascal.org/mailman/listinfo/fpc-pascal




-- 
I am using last revision of Lazarus, FPC 2.6 on Windows XP SP3

Best Regards
Zaher Dirkey
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] How to close TInetServer without except?

2013-05-04 Thread Ludo Brands
On 05/04/2013 08:00 PM, Zaher Dirkey wrote:
 Hmm there is diffrents
 Yours
 res:=select(sock+1,@readfds,@writefds,@exceptfds,@tv);
 Mine
 c := WinSock2.select(0, PSetRead, PSetWrite, nil, @TimeVal);
 
 0 here in mine, in yours sock+1 (FHandle+1 in mine).
 I will take more testing.
 
 

According to
http://msdn.microsoft.com/en-us/library/windows/desktop/ms740141(v=vs.85).aspx
:
nfds [in] Ignored. The nfds parameter is included only for
compatibility with Berkeley sockets.

I wrote the code for linux and then ported it to windows.

However, in your code you do
if (c = 0) or (c = SOCKET_ERROR) then
  begin
Error;

which is not correct. c=0 is the result of select returning after a
timeout. It is not an error.
The fact that
   if Socket.Select(1, slRead) = erNone then
is blocked forever​ is not normal. It should at least return after 10
seconds.



Ludo



___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Porting C variable declaration

2013-05-04 Thread Darius Blaszyk


Thanks Jonas! 

Jonas Maebe schreef op 4 mei '13: 

 On 04 May 2013, at 10:25, Darius Blaszyk wrote:
 
 I came across a pointer variable in C which also get's assigned integer 
 values. Anyone has an idea how to port this in FPC? The variable is declared 
 as: static void *x=0; Later on it get's assigned as this: x= 1;
 
 var
 x: pointer;
 begin
 x:=nil; { 0 is guaranteed to map to NULL/nil in C }
 x:=pointer(1);
 end.
 ___
 fpc-pascal maillist - fpc-pascal@lists.freepascal.org
 http://lists.freepascal.org/mailman/listinfo/fpc-pascal [1]


Links:
--
[1] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] FPC cross compilation error: cannot find -lgcc

2013-05-04 Thread patspiper

On 12/04/13 00:11, patspiper wrote:

On 12/04/13 00:08, patspiper wrote:

On 11/04/13 23:25, Marco van de Voort wrote:

In our previous episode, patspiper said:
Cross compilation from Ubuntu 32 bit to Win32, WIn64, and Linux 64 
works

well with FPC 2.6.0.

With FPC 2.7.1, any cross compilation yields a 'cannot find -lgcc' 
error.
Linking what file generates that error when crosscompiling to win32 
or win64?
Below is the relevant part of the log for Win32 with FPC2.7.1 
(fpmake.pp):


make -C packages smart
make[2]: Entering directory 
`/home/me/Programs/fpc/fpsrc/exported/2.7.1/packages'

make -C fpmkunit bootstrap
make[3]: Entering directory 
`/home/me/Programs/fpc/fpsrc/exported/2.7.1/packages/fpmkunit'

/bin/mkdir -p units_bs/i386-linux
/home/me/Programs/fpc/fpsrc/exported/2.7.1/compiler/ppc 
src/fpmkunit.pp -n 
-Fu/home/me/Programs/fpc/fpsrc/exported/2.7.1/rtl/units/i386-linux 
-Fu/home/me/Programs/fpc/fpsrc/exported/2.7.1/packages/paszlib 
-Fu/home/me/Programs/fpc/fpsrc/exported/2.7.1/packages/fcl-process 
-Fu/home/me/Programs/fpc/fpsrc/exported/2.7.1/packages/hash 
-FUunits_bs/i386-linux -Fu../paszlib/src -Fu../hash/src 
-Fi../paszlib/src  -Fi../fcl-process/src/unix -Fu../fcl-process/src 
-Fi../fcl-process/src/linux -Fi../fcl-process/src/dummy -Xd -Xt -gl
make[3]: Leaving directory 
`/home/me/Programs/fpc/fpsrc/exported/2.7.1/packages/fpmkunit'
/home/me/Programs/fpc/fpsrc/exported/2.7.1/compiler/ppc fpmake.pp -n 
-Fu/home/me/Programs/fpc/fpsrc/exported/2.7.1/packages/fpmkunit/units_bs/i386-linux 
-Fu/home/me/Programs/fpc/fpsrc/exported/2.7.1/rtl/units/i386-linux 
-Xd -Xt -gl
/usr/bin/ld: warning: link.res contains output sections; did you 
forget -T?
/home/me/Programs/fpc/fpsrc/exported/2.7.1/rtl/units/i386-linux/cthreads.o: 
In function `CTHREADS_$$_init':
/home/me/Programs/fpc/fpsrc/exported/2.7.1/rtl/linux/../unix/cthreads.pp:1032: 
warning: Using 'dlopen' in statically linked applications requires at 
runtime the shared libraries from the glibc version used for linking

/usr/bin/ld: cannot find -lgcc
fpmake.pp(33,1) Error: Error while linking
fpmake.pp(33,1) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
make[2]: *** [fpmake] Error 1
make[2]: Leaving directory 
`/home/me/Programs/fpc/fpsrc/exported/2.7.1/packages'

make[1]: *** [packages_smart] Error 2

Linux 64 with FPC2.6.3 fails while linking fpdoc.pp:
/home/me/Programs/fpc/fpsrc/exported/2.6.3/compiler/ppcrossx64 
-Px86_64 -XPx86_64-linux- -Xr 
-Fl/home/me/Programs/fpc/crossbinutils/lib//x86_64-linux -Ur -Xs -O2 
-n -S2h 
-Fu/home/me/Programs/fpc/fpsrc/exported/2.6.3/rtl/units/x86_64-linux 
-Fu/home/me/Programs/fpc/fpsrc/exported/2.6.3/packages/fcl-base/units/x86_64-linux 
-Fu/home/me/Programs/fpc/fpsrc/exported/2.6.3/packages/iconvenc/units/x86_64-linux 
-Fu/home/me/Programs/fpc/fpsrc/exported/2.6.3/packages/fcl-xml/units/x86_64-linux 
-Fu/home/me/Programs/fpc/fpsrc/exported/2.6.3/packages/fcl-passrc/units/x86_64-linux 
-Fu/home/me/Programs/fpc/fpsrc/exported/2.6.3/packages/chm/units/x86_64-linux 
-FD/home/me/Programs/fpc/crossbinutils/bin -FE. -FUunits/x86_64-linux 
-Cg -Flinclude -Fl/etc/ld.so.conf.d/*.conf -Xd -Xt -gl -dx86_64 
-dRELEASE  fpdoc.pp
/home/me/Programs/fpc/crossbinutils/bin/x86_64-linux-ld: warning: 
./link.res contains output sections; did you forget -T?
/home/me/Programs/fpc/crossbinutils/bin/x86_64-linux-ld: cannot find 
-lgcc

/home/me/Programs/fpc/crossbinutils/bin/x86_64-linux-ld: cannot find -lc


Just to clarify: It is the building of the cross compiler that fails.

Bump

Note: I have submitted 2 related bug reports:
http://bugs.freepascal.org/view.php?id=24262
http://bugs.freepascal.org/view.php?id=24372

Stephano
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] How to close TInetServer without except?

2013-05-04 Thread Zaher Dirkey
On Sat, May 4, 2013 at 9:42 PM, Ludo Brands ludo.bra...@free.fr wrote:


 However, in your code you do
 if (c = 0) or (c = SOCKET_ERROR) then
   begin
 Error;

 which is not correct. c=0 is the result of select returning after a
 timeout. It is not an error.
 The fact that
if Socket.Select(1, slRead) = erNone then
 is blocked forever​ is not normal. It should at least return after 10
 seconds.


​I am not testing in linux it is broked with me and i have not good
internet to fix it.

now in this example
http://msdn.microsoft.com/en-us/library/windows/desktop/ms737526%28v=vs.85%29.aspx
They not use Select before acce​pt

and in
http://msdn.microsoft.com/en-us/library/windows/desktop/ms740141%28v=vs.85%29.aspx

The parameter *readfds* identifies the sockets that are to be checked for
readability. If the socket is currently in the
*listen*http://msdn.microsoft.com/en-us/library/windows/desktop/ms739168%28v=vs.85%29.aspxstate,
it will be marked as readable if an incoming connection request has
been received such that an
*accept*http://msdn.microsoft.com/en-us/library/windows/desktop/ms737526%28v=vs.85%29.aspxis
guaranteed to complete
*without blocking*.

I still not sure in windows need Select, but maybe in Linux only, but i
can't test it there.



-- 
I am using last revision of Lazarus, FPC 2.6 on Windows XP SP3

Best Regards
Zaher Dirkey
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Compileability of target WinCE restored

2013-05-04 Thread Sven Barth

On 04.05.2013 13:28, Zaher Dirkey wrote:

Did tried my modification in the bug tracker?


Do you mean regarding the Canvas problems? Sorry, not yet... :(

Regards,
Sven

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] CoreFoundation Freepascal MAC OSX

2013-05-04 Thread m...@rpzdesign.com

Anybody have any success with the included units for
CoreFoundation on Mac OSX.



I was trying to use CFSetGetCount( ) function call, it is clearly 
defined in CFSet.pas

and yet the linker error is:

Identifier Not Found CFSetGetCount

But magically, the constants from CFBase.pas compile OK, so it must
be the compiler directives at the top of CFSET.pas that are preventing
that code from getting included and visible by the compiler.

#
program testcfset;

uses
  CFBase, CFSet ;
var
 fcnt : single ;
 ret : integer ;
begin
 fcnt := kCFCoreFoundationVersionNumber10_2 ;
 ret := CFSetGetCount(nil) ;
end.

{  Compiler messages Below:
testcfset.lpr(6,2) Note: Local variable fcnt is assigned but never used
testcfset.lpr(7,2) Note: Local variable ret is assigned but never used
ld: symbol(s) not found for architecture i386
Undefined symbols for architecture i386:
  _CFSetGetCount, referenced from:
  _PASCALMAIN in testcfset.o
ld: symbol(s) not found for architecture i386
An error occurred while linking
testcfset.lpr(10,2) Error: Error while linking
testcfset.lpr(10,2) Fatal: There were 1 errors compiling module, stopping
}
##

On another project before I built the test project,
I saw these errors:

ld : symbol(s) not found for architecture i386.

Undefined symbols for architecture i386:
_CFSetGetCount referenced from : (my code mangled name)

Anybody have a clue how to force the compiler to see and use CFSet.ppu
from inside /usr/local/lib/fpc/2.6.2/

My machine in Mac Mini 2010 with OSX Lion and XCode 4.6.2 Apr 15 with 
command line tools of same date.


I am working under Lazarus 1.08.  All the PPU files are where they 
should be.


Somebody from the Mac Guru crowd have any comments

Thanks,

md
program testcfset;

uses
  CFBase, CFSet ;
var
 fcnt : single ;
 ret : integer ;
begin
 fcnt := kCFCoreFoundationVersionNumber10_2 ;
 ret := CFSetGetCount(nil) ;
end.

{
testcfset.lpr(6,2) Note: Local variable fcnt is assigned but never used
testcfset.lpr(7,2) Note: Local variable ret is assigned but never used
ld: symbol(s) not found for architecture i386
Undefined symbols for architecture i386:
  _CFSetGetCount, referenced from:
  _PASCALMAIN in testcfset.o
ld: symbol(s) not found for architecture i386
An error occurred while linking
testcfset.lpr(10,2) Error: Error while linking
testcfset.lpr(10,2) Fatal: There were 1 errors compiling module, stopping
}
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal