Re: [fpc-pascal] Defining sonames?

2017-08-17 Thread Sven Barth via fpc-pascal
Am 18.08.2017 01:17 schrieb "Graeme Geldenhuys" <
mailingli...@geldenhuys.co.uk>:
>
> On 2017-08-17 21:47, Henry Vermaak wrote:
>>
>> You can use -l:libgreat.so.1 with gcc to link to a specific library
version
>> (iirc).
>
>
> I'll have to take your word for it Henry, as I don't know GCC much - only
the bare minimum to compile small C projects. I normally specify things
like -lpthreads -lX11 etc. I've never seen a versioned -l parameter being
used. I'll try it next time.

Passing a name with ":" to the linker works (on Linux at least). I used
that when I tested dynamic packages and wanted the linker to use
"librtl.ppl" instead of "librtl.so" ;)

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

Re: [fpc-pascal] Defining sonames?

2017-08-17 Thread Martin Schreiber
On Thursday 17 August 2017 22:20:44 Graeme Geldenhuys wrote:
> On 2017-08-17 16:52, Martin Schreiber wrote:
> > Exactly. So why not use the SONAME in the Pascal binding unit instead to
> > use the base name as Free Pascal currently does in xlib.pp for example?
>
> I forked the xlib, xutils and x units from FPC and tried just that. It
> made no difference.

Did you remove the various {$linklib} statements too?
Did you check all units which where included by "uses" statements?
BTW I tried to fork xlib.pp too but gave up because of the too many files 
which hat do be forked and it was too dangerous for existing projects.

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

Re: [fpc-pascal] Pascal support in the Kattis educational site

2017-08-17 Thread kapibara via fpc-pascal
The results may be sorted also by language name and so all C++ results 
comes in before Pascal even if runtime is the same. Your program was as 
fast as No1 but anyway not visible among top ten. This outrageous! ;-)



On 08/17/2017 10:21 AM, Ingemar Ragnemalm wrote:


A bit of news which I think has some interest here:

"Kattis" (open.kattis.com) is a site where students can make 
programming exercises. This is quite important IMHO; companies look at 
Kattis results when recruiting.


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

Re: [fpc-pascal] Defining sonames?

2017-08-17 Thread Graeme Geldenhuys

On 2017-08-17 22:17, Marco van de Voort wrote:

if some distribution halfway through the release cycle starts packaging a
new version.


But surely then the program would be broken anyway - in the case of a 
major version number bump. It is well known that major version changes 
mean two versions are NOT compatible.


What Martin is getting at is that by looking at the Object Pascal unit, 
one will then easily be able to see which major version of the library 
is supported by that header translation *.pp file. The linker will also 
complain and say that that specific library version is not install. 
That's a better error that some runtime crash or error about a API 
parameter that is now slightly different.


And just to be clear, by saying using the versioned library in the 
header translation unit, you will use the versioned library that only 
mentions the major version. eg:  'libgreat.so.1'and not 
'libgreat.so.1.2.7'


Either way, I tried the latter as I mentioned, and it made no difference 
to FPC. Somewhere the version info was stripped and only the base name 
was passed to the linker.


Regards,
  Graeme

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

My public PGP key:  http://tinyurl.com/graeme-pgp
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Defining sonames?

2017-08-17 Thread Graeme Geldenhuys

On 2017-08-17 21:47, Henry Vermaak wrote:

You can use -l:libgreat.so.1 with gcc to link to a specific library version
(iirc).


I'll have to take your word for it Henry, as I don't know GCC much - 
only the bare minimum to compile small C projects. I normally specify 
things like -lpthreads -lX11 etc. I've never seen a versioned -l 
parameter being used. I'll try it next time.


Regards,
  Graeme

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

My public PGP key:  http://tinyurl.com/graeme-pgp
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Defining sonames?

2017-08-17 Thread Sven Barth via fpc-pascal
Am 17.08.2017 22:20 schrieb "Graeme Geldenhuys" <
mailingli...@geldenhuys.co.uk>:
>
> On 2017-08-17 16:52, Martin Schreiber wrote:
>>
>> Exactly. So why not use the SONAME in the Pascal binding unit instead to
use
>> the base name as Free Pascal currently does in xlib.pp for example?
>
>
> I forked the xlib, xutils and x units from FPC and tried just that. It
made no difference. When I compiled the project with the -Cn command line
parameter I reviewed the ppas.sh and .res file. The .res file has
a INPUT section near the end listing all dependent libraries. They are
translated to the same as when you use GCC's -l command line parameter.
Only the base name of the library is used. Also, apparently the Unix/Linux
linker (FPC doesn't have it's own - only for Windows) doesn't support
versioned library names as command line parameters. So I don't think there
is much FPC can do - unless I'm still not understanding the whole compiling
and linking process, unless FPC implements their own linker under Unix-type
OSes too.

FPC does have its own, internal ELF linker, though that is not enabled by
default currently as it still has its shortcomings. But even then it would
follow the conventions of the target OS.

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

Re: [fpc-pascal] Defining sonames?

2017-08-17 Thread Marco van de Voort
In our previous episode, Martin Schreiber said:
> > nevertheless be failures if the applications
> > is programmed against the interface of the older v1 library (maybe they
> > changed the memory management for v2 and the problem will only manifest at
> > runtime).
> >
> Exactly. So why not use the SONAME in the Pascal binding unit instead to use 
> the base name as Free Pascal currently does in xlib.pp for example?

Because it is is not packaged with and meant only to work with only one .so
name. Changing it will only mean a lot of adminstration, and still breakage
if some distribution halfway through the release cycle starts packaging a
new version.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Defining sonames?

2017-08-17 Thread Henry Vermaak
On 17 Aug 2017 21:21, "Graeme Geldenhuys" 
wrote:

On 2017-08-17 16:52, Martin Schreiber wrote:

> Exactly. So why not use the SONAME in the Pascal binding unit instead to
> use
> the base name as Free Pascal currently does in xlib.pp for example?
>

I forked the xlib, xutils and x units from FPC and tried just that. It made
no difference. When I compiled the project with the -Cn command line
parameter I reviewed the ppas.sh and .res file. The .res file has
a INPUT section near the end listing all dependent libraries. They are
translated to the same as when you use GCC's -l command line parameter.
Only the base name of the library is used. Also, apparently the Unix/Linux
linker (FPC doesn't have it's own - only for Windows) doesn't support
versioned library names as command line parameters. So I don't think there
is much FPC can do - unless I'm still not understanding the whole compiling
and linking process, unless FPC implements their own linker under Unix-type
OSes too.


You can use -l:libgreat.so.1 with gcc to link to a specific library version
(iirc).

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

Re: [fpc-pascal] Defining sonames?

2017-08-17 Thread Graeme Geldenhuys

On 2017-08-17 16:52, Martin Schreiber wrote:

Exactly. So why not use the SONAME in the Pascal binding unit instead to use
the base name as Free Pascal currently does in xlib.pp for example?


I forked the xlib, xutils and x units from FPC and tried just that. It 
made no difference. When I compiled the project with the -Cn command 
line parameter I reviewed the ppas.sh and .res file. The .res 
file has a INPUT section near the end listing all dependent libraries. 
They are translated to the same as when you use GCC's -l command line 
parameter. Only the base name of the library is used. Also, apparently 
the Unix/Linux linker (FPC doesn't have it's own - only for Windows) 
doesn't support versioned library names as command line parameters. So I 
don't think there is much FPC can do - unless I'm still not 
understanding the whole compiling and linking process, unless FPC 
implements their own linker under Unix-type OSes too.


Regards,
  Graeme

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

My public PGP key:  http://tinyurl.com/graeme-pgp
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Serial communications: synaser vs FPC's serial unit

2017-08-17 Thread Graeme Geldenhuys

On 2017-08-17 18:05, gebylist wrote:

For most actual Synaser version you must look at Synapse SVN server.;-)

Synaser have class TBlockSerial. It can work with*any*  device name. (It
know to emulate Windows COMxx names on Linux too.)



Thank you Lukas, I'll make sure to get the latest from SVN and go from 
there. I'll probably try both Serial.pp and Synaser just to make sure.


Regards,
  Graeme

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

My public PGP key:  http://tinyurl.com/graeme-pgp
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Serial communications: synaser vs FPC's serial unit

2017-08-17 Thread gebylist
Dne 17.08.2017 v 15:45 Graeme Geldenhuys napsal(a):
>
> Now for the Synaser unit - the one I have is from 2013, and I already 
> noticed that there is no support for FreeBSD's /dev/* names to access 
> serial ports. Granted I added FreeBSD support to the 
> GetSerialPortNames() function in 5 minutes, but this doesn't bode to 
> well then for the Synaser unit - what else could be missing that I 
> don't know of?

For most actual Synaser version you must look at Synapse SVN server. ;-)

Synaser have class TBlockSerial. It can work with *any* device name. (It 
know to emulate Windows COMxx names on Linux too.)

GetSerialPortnames is just helper funcion, what is designed for windows 
only first. Some platforms are added later, but it cannot be fully 
multiplatform. However it is just helper for get list of existing serial 
ports. If you know serial device name, you not need it.

Lukas Gebauer
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Defining sonames?

2017-08-17 Thread Martin Schreiber
On Thursday 17 August 2017 17:31:46 Sven Barth via fpc-pascal wrote:
> Am 17.08.2017 15:49 schrieb "Graeme Geldenhuys" <
>
> mailingli...@geldenhuys.co.uk>:
> > On 2017-08-16 18:14, Sven Barth via fpc-pascal wrote:
> >> As you can see the program will work correctly as long as the
> >> libX11.so.6 file exists (even though that is a symlink itself, but the
> >> X11 project guarantees that different libX11.so.6.x.y are compatible to
> >> eachother), because the linker picks the SONAME that is set inside the
> >> binary. And the libX11.so.6 symlink is part of the non-devel package.
> >
> > Sven, now here is an interesting problem regarding the way FPC (or Object
>
> Pascal in general) works with C based libraries. Martin pointed this out in
> another mailing list, and he gave me permission to forward it here. What is
> your answer or recommendation to this problem?
>
> Write in your application's readme which versions it requires. It might be
> true that the devel packages contain the C-headers, but there might
> nevertheless be failures if the applications
> is programmed against the interface of the older v1 library (maybe they
> changed the memory management for v2 and the problem will only manifest at
> runtime).
>
Exactly. So why not use the SONAME in the Pascal binding unit instead to use 
the base name as Free Pascal currently does in xlib.pp for example?

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

Re: [fpc-pascal] Defining sonames?

2017-08-17 Thread Sven Barth via fpc-pascal
Am 17.08.2017 15:49 schrieb "Graeme Geldenhuys" <
mailingli...@geldenhuys.co.uk>:
>
> On 2017-08-16 18:14, Sven Barth via fpc-pascal wrote:
>>
>> As you can see the program will work correctly as long as the
>> libX11.so.6 file exists (even though that is a symlink itself, but the
>> X11 project guarantees that different libX11.so.6.x.y are compatible to
>> eachother), because the linker picks the SONAME that is set inside the
>> binary. And the libX11.so.6 symlink is part of the non-devel package.
>
>
> Sven, now here is an interesting problem regarding the way FPC (or Object
Pascal in general) works with C based libraries. Martin pointed this out in
another mailing list, and he gave me permission to forward it here. What is
your answer or recommendation to this problem?

Write in your application's readme which versions it requires. It might be
true that the devel packages contain the C-headers, but there might
nevertheless be failures if the applications
is programmed against the interface of the older v1 library (maybe they
changed the memory management for v2 and the problem will only manifest at
runtime).

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

Re: [fpc-pascal] Defining sonames?

2017-08-17 Thread Graeme Geldenhuys

On 2017-08-16 18:14, Sven Barth via fpc-pascal wrote:

As you can see the program will work correctly as long as the
libX11.so.6 file exists (even though that is a symlink itself, but the
X11 project guarantees that different libX11.so.6.x.y are compatible to
eachother), because the linker picks the SONAME that is set inside the
binary. And the libX11.so.6 symlink is part of the non-devel package.


Sven, now here is an interesting problem regarding the way FPC (or 
Object Pascal in general) works with C based libraries. Martin pointed 
this out in another mailing list, and he gave me permission to forward 
it here. What is your answer or recommendation to this problem?




 Forwarded Message 
Subject: Re: [MSEide-MSEgui-talk] MSE and XLib.
Date: Thu, 17 Aug 2017 14:54:16 +0200
From: Martin Schreiber
To: mseide-msegui-t...@lists.sourceforge.net

On Thursday 17 August 2017 10:54:31 Graeme Geldenhuys wrote:
> On 2017-08-17 07:18, Martin Schreiber wrote:
> > I don't understand why FPC uses the version-less library
> > names instead of the mayor version names where the bindings are 
made for.

> > Maybe a misunderstanding happened at ancient times...
>
> No, they are simply following the guidelines of Unix-type systems -
> doing everything correctly by the book.

A hypothetical example:

- You make a pascal bindings file for the "greatlibrary" version 1.0.
- You set the library name in the bindings pascal file "great.pas" to 
"great" as Unix-type systems guidelines command.
- In your system great-devel package of the version 1.0.1 is installed, 
you have the c-header *.h files of libgreat 1.0.1 and the links 
libgreat.so -> libgreat.so.1 -> libgreat.so.1.0.1.

- The SONAME of libgreat.so.1.0.1 is libgreat.so.1
- You compile and run the application, libgreat.so.1 -> 
libgreat.so.1.0.1 is loaded, all is OK.


Now you give the source of the application to a colleague who has 
installed the newer but incompatible "greatlibrary" version 2.0.3 
including the devel package.
- He has the c-header *.h files of libgreat 2.0.3 and links libgreat.so 
-> libgreat.so.2 -> libgreat.so.2.0.3.

- The SONAME of libgreat.so.2.0.3 is libgreat.so.2
- He compiles your program, the linker links libgreat.so -> 
libgreat.so.2 -> libgreat.so.2.0.3 and stores the SONAME libgreat.so.2 
(remember, libgreat.so.2 and libgreat.so.1 are *not* compatible).


Now there are two possibilities, maybe the function names in 
libgreat.pas did not change between version 1 and 2 -> the program 
compiles but crashes because of changed parameters or other 
incompatibilities.
Or it does not compile and then he needs to install version 1 of 
"greatlibrary" and deinstall great-devel-2.0.3 and install 
great-devel-1.0.1 or change manually libgreat.so -> libgreat.so.2 to 
libgreat.so -> libgreat.so.1 temporarily.
This also must be done in first case in order to produce a working 
application.


The difference between a FPC bindings unit and a Unix C-header *.h file 
is that the *.h file is *included* in the devel-package and thus matches 
the installed version, the pascal file is not included but in a separate 
package or more likely taken from the FPC tar archive by the FPC install 
script because FPC Linux/FreeBSD-packages usually are too old or one 
wants to use a FPC version from SVN.
So the "guidelines for Unix-type systems" are not appropriate for Free 
Pascal C-library binding units IMHO.


Martin
---



Regards,
  Graeme

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

My public PGP key:  http://tinyurl.com/graeme-pgp
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

[fpc-pascal] Serial communications: synaser vs FPC's serial unit

2017-08-17 Thread Graeme Geldenhuys

Hi,

If somebody with more experience (than me) with the Synaser and FPC 
serial.pp units could comment, that would be much appreciated.


For a new cross-platform project where I need to talk to a device hooked 
up to a serial port, which unit would be the best to use? Normally I 
would go with units included with FPC simply because I know they are 
strict about keeping everything maintained.


When I say cross-platform, I'm currently talking about Windows and 
Linux, and possibly FreeBSD and Mac too.


Now for the Synaser unit - the one I have is from 2013, and I already 
noticed that there is no support for FreeBSD's /dev/* names to access 
serial ports. Granted I added FreeBSD support to the 
GetSerialPortNames() function in 5 minutes, but this doesn't bode to 
well then for the Synaser unit - what else could be missing that I don't 
know of?


Regards,
  Graeme

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

My public PGP key:  http://tinyurl.com/graeme-pgp
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] homepage - no foundation link

2017-08-17 Thread Michael Van Canneyt



On Thu, 17 Aug 2017, Graeme Geldenhuys wrote:


Hi,

Maybe I'm going blind (considering the amount of screen time its very 
likely), but I don't see any link to the Free Pascal Foundation from the 
Free Pascal homepage?


  https://www.freepascal.org/


Why is that? Surely the two should be related.

On a side note:
  Also, why isn't there a "Donation" link on the homepage? I would
  assume donating to the Foundation means the Free Pascal project
  would benefit?


You assume right.

I will add a page/link to the website this weekend.

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

[fpc-pascal] homepage - no foundation link

2017-08-17 Thread Graeme Geldenhuys

Hi,

Maybe I'm going blind (considering the amount of screen time its very 
likely), but I don't see any link to the Free Pascal Foundation from the 
Free Pascal homepage?


  https://www.freepascal.org/


Why is that? Surely the two should be related.

On a side note:
  Also, why isn't there a "Donation" link on the homepage? I would
  assume donating to the Foundation means the Free Pascal project
  would benefit?

Regards,
  Graeme

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

[fpc-pascal] Pascal support in the Kattis educational site

2017-08-17 Thread Ingemar Ragnemalm


A bit of news which I think has some interest here:

"Kattis" (open.kattis.com) is a site where students can make programming 
exercises. This is quite important IMHO; companies look at Kattis 
results when recruiting.


Recently, Kattis added Pascal support, using FPC 3.0.0! (Free Pascal 
version 3.0.0+dfsg-2 whatever that means. The server runs Linux.)


I have made some of the exercises, and it works well. Not only that, I 
routinely score in the top group in performance (together with all the 
C++ solutions)! This is, of course, a matter of programming well, but it 
is fun to see FPC outperforming Java all the time - and this is visible 
to all users! Of course, *one* fast Pascal solution won't be noticed by 
many, but still I think it is an opportinuty to show that our language 
is useful!


For instance, here is the statistics for the "Good Morning" problem. 
Yes, that "1" on Pascal is me.


https://open.kattis.com/problems/goodmorning/statistics

Most importantly, it means that an important educational tool accepts 
FPC! Pascal students can now compete with the C++ students!


/Ingemar


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

Re: [fpc-pascal] TStringList - Strange quotation mark handling

2017-08-17 Thread el es
On 16/08/17 15:45, Benito van der Zander wrote:
> Hi,

[sorry I could not stop myself from reordering your top-post]

> Am 16.08.2017 um 15:48 schrieb Gabor Boros:
>> 2017. 08. 16. 15:21 keltezéssel, Michael Van Canneyt írta:
>>> Because the quotes must be the first and last character of each
>>> string (or "cell").
>>> 
>>> As noted in another reply, set the quote character to something
>>> unused, and it will disable (or circumvent) quoting altogether.
>> 
>> SL2.QuoteChar:=#0; solved my problem. But strange if the
>> TStringList think from a starting " the string is quoted. For
>> example if data.cvs contains "abc|89|0 I got the next result with
>> my example program (without QuoteChar trick): 0 * abc|89|0
>> 
>> Gabor ___
> 
> very stupid defaults indeed.
> 
> I just had a bug last week, because I was using TStringList as map
> and forgot to change it to case-sensitive
> 

Because the default format of QuotedText is actually 'csv',
which goes like "field 1 = value 1","value 2","field 3" 
and StringList was created to deal with that  (I think).
You can bend QuotedText to do amazing things but the quote detector
is set for the default "" here.

> 
> 
> Cheers, Benito
> 
> 
> 
el es

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