Re: [fpc-pascal] unit for PHostEnt definition

2015-12-17 Thread leledumbo
> after a whole night of unsuccessful googling I’m still wondering, which
unit(s) I have to use to find a type definition of PHostEnt in linux. I need
it for the gethostbyname function.
> 
> In Windows it’s defined in winsock and there should be an equivalent
> record in linux according to systems “man gethostbyname”

netdb, both the function and the type definition are there.



--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/unit-for-PHostEnt-definition-tp5723392p5723396.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] specialize, identifier not found

2015-12-17 Thread Santiago A.
El 16/12/2015 a las 21:01, Sven Barth escribió:
> Mode Delphi follows Delphi's syntax, thus no "generic" and
> "specialize" keywords.
Yes, you are right. I was just looking the objfpc syntax.
>
> The problem isn't default indexed properties. I guess your TRegAlias
> is a record, thus it will be victim of this:
> http://wiki.freepascal.org/User_Changes_2.4.0#Treating_direct-mapped_properties_as_regular_fields

Yes, it looks like that's the problem.

TReg=record
  regField_1:string;
  regField_1:string;
end;

TMyObject=object
  ...
  property Reg:TReg read getReg write setReg;
end;

Var myObject:TMyObject;

I Can't do this:

myObject.reg.regField_1:='A';
myObject.reg.regField_2:='B';

I have to do this:

var auxReg:TReg;
...
auxReg:=myObject.reg;
auxReg.regField_1:='A';
auxReg.regField_2:='B';
myObject.reg:=auxReg;

I can live with no passing them as var parameters, but I thing it is a
little cumbersome for setting fields.  I will try using pointers.

Thanks, it was driving me mad.

-- 
Saludos
Santiago A.

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

Re: [fpc-pascal] specialize, identifier not found

2015-12-17 Thread Sven Barth
Am 17.12.2015 11:18 schrieb "Santiago A." :
> I can live with no passing them as var parameters, but I thing it is a
> little cumbersome for setting fields.  I will try using pointers.

What do you mean with var-parameters?

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

Re: [fpc-pascal] set code page

2015-12-17 Thread Dariusz Mazur

On 2015-12-17 13:40, Mattias Gaertner wrote:

On Thu, 17 Dec 2015 13:36:17 +0100
Dariusz Mazur  wrote:


Hi
is there possible to set codepage {$codepage xxx} to cp_none

Do you mean CP_ACP?

maybe yes, this don't know  as well
--
Darek

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


[fpc-pascal] FPC 3.0 vs 2.6.4 under FreeBSD

2015-12-17 Thread Graeme Geldenhuys
Hi,

Just wanted to say kudos to the Free Pascal team for doing a GREAT job
with FPC 3.0.

I did a couple of tests and the exact same project with exact same
compiler parameters is much improved when compiled with FPC 3.0  (vs 2.6.4)

For example. The 64-bit executable size reduced from 2.35MB down to
1.42MB. I used -O2 optimization and the application speed went from 0.35
seconds down to 0.24 seconds for the same task.

So smaller executables and faster executables - awesome work!!

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] FPC 3.0 vs 2.6.4 under FreeBSD

2015-12-17 Thread Jonas Maebe


Graeme Geldenhuys wrote on Thu, 17 Dec 2015:


For example. The 64-bit executable size reduced from 2.35MB down to
1.42MB.


It is very unlikely that this difference is primarily due to  
improvements in compiler code or data generation between 2.6.4 and  
3.0. Maybe one of these binaries is stripped and the other not (maybe  
some default changed on FreeBSD), or one is smart linked and the other  
is not (maybe the old shipped units were not smartlinkable and the new  
ones are, or something like that).



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


Re: [fpc-pascal] FPC 3.0 vs 2.6.4 under FreeBSD

2015-12-17 Thread Graeme Geldenhuys
On 2015-12-17 13:23, Graeme Geldenhuys wrote:
> Nope, the news seems to be that good. ;-)

I tried with a few projects now, and the executable is always smaller
when compiled with FPC 3.0

Here is another example:

-rwxr-xr-x  1 graemeg  graemeg  1551040 17 Dec 13:28 docview-2.6.4
-rwxr-xr-x  1 graemeg  graemeg  1394688 17 Dec 13:27 docview-3.0.0



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] set code page

2015-12-17 Thread Dariusz Mazur

Hi
  is there possible to set codepage {$codepage xxx} to cp_none

for example one source file have {$codepage 1250} but rest i need 
default (without any setting)



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


Re: [fpc-pascal] specialize, identifier not found

2015-12-17 Thread Santiago A.
El 17/12/2015 a las 11:35, Sven Barth escribió:
>
> Am 17.12.2015 11:18 schrieb "Santiago A."  >:
> > I can live with no passing them as var parameters, but I thing it is a
> > little cumbersome for setting fields.  I will try using pointers.
>
> What do you mean with var-parameters?
>

I can't use the field as actual parameter of function with a var parameter:

function foo(var n:integer);
begin
 n:=n+1;
end;

foo(myObject.Reg.fieldReg)

-- 
Saludos

Santi
s...@ciberpiula.net

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

Re: [fpc-pascal] set code page

2015-12-17 Thread Mattias Gaertner
On Thu, 17 Dec 2015 13:36:17 +0100
Dariusz Mazur  wrote:

> Hi
>is there possible to set codepage {$codepage xxx} to cp_none

Do you mean CP_ACP?

 
> for example one source file have {$codepage 1250} but rest i need 
> default (without any setting)


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


Re: [fpc-pascal] FPC 3.0 vs 2.6.4 under FreeBSD

2015-12-17 Thread Jonas Maebe


Graeme Geldenhuys wrote on Thu, 17 Dec 2015:


On 2015-12-17 13:14, Jonas Maebe wrote:

It is very unlikely that this difference is primarily due to
improvements in compiler code or data generation between 2.6.4 and
3.0. Maybe one of these binaries is stripped and the other not


Nope, the news seems to be that good. ;-)


As mentioned in my original mail, the difference may be due different  
defaults in the compiler or in the units shipped with it (maybe even  
specifically to  FreeBSD). There really has been no improvement in the  
compiler or RTL that magically cuts binary sizes almost in half.



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


Re: [fpc-pascal] FPC 3.0 vs 2.6.4 under FreeBSD

2015-12-17 Thread Graeme Geldenhuys
On 2015-12-17 13:14, Jonas Maebe wrote:
> It is very unlikely that this difference is primarily due to  
> improvements in compiler code or data generation between 2.6.4 and  
> 3.0. Maybe one of these binaries is stripped and the other not

Nope, the news seems to be that good. ;-)

I used MSEide to compile my project. All units involved are compiled as
part of the project (no "packages" with different compiler settings like
Lazarus does). All previously compiled units were removed between
compilations (compiled units are output to a single directory so makes
the task easy). Compiler settings are identical, and so too is the
~/.fpc.cfg file. I simply told MSEide to switch between FPC executables.

I was pleasantly surprised by the outcome 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] specialize, identifier not found

2015-12-17 Thread Sven Barth
Am 17.12.2015 13:37 schrieb "Santiago A." :
>
> El 17/12/2015 a las 11:35, Sven Barth escribió:
>>
>> Am 17.12.2015 11:18 schrieb "Santiago A." :
>> > I can live with no passing them as var parameters, but I thing it is a
>> > little cumbersome for setting fields.  I will try using pointers.
>>
>> What do you mean with var-parameters?
>
>
> I can't use the field as actual parameter of function with a var
parameter:
>
> function foo(var n:integer);
> begin
>  n:=n+1;
> end;
>
> foo(myObject.Reg.fieldReg)

That has an analogous reason as for the other problem. See here:
http://wiki.freepascal.org/User_Changes_2.6.0#Taking_the_address_of_fields_of_record_properties

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

[fpc-pascal] Lack of 'volatile' a serious issue. Any other such caveats?

2015-12-17 Thread R. Diez

Hi all:

I have fond memories of Turbo Pascal and Delphi, and the latest 
FreePascal version seems promising enough. When I read that you can also 
write embedded firmware with it, I decided to have a look. I need a 
Windows and Linux GUI for my embedded firmware, and a development 
environment that can do both is pretty enticing.


The first thing I wondered is how come that not everyone is using 
FreePascal by now. After Visual Basic turned .NET and Delphi lost focus 
(the IDE became big, slow and expensive), FreePascal/Lazarus seems a 
perfect fit. What could be the reason? Only a few open-source projects 
are honest enough to have a "Caveats" or "Disadvantages" page, and 
FreePascal does not seem to be among them. The "Known Problem" page does 
not actually fit the bill.


The only thing I found when searching for "FreePascal disadvantages" was 
a general dislike of the Pascal language, which may be justified if 
there are many more gotchas like this:


  "for loop variable value reliable after loop?"
  http://lists.freepascal.org/pipermail/fpc-pascal/2015-October/045446.html

And there you go, I haven't quite started yet and I already discovered 
the first serious issue: there is no 'volatile' keyword. This matter has 
been brought up in the past, and it worries me that it has just been 
downplayed.


C's 'volatile' semantics are not perfect, but you need something along 
that line when writing multi-threaded programs, or when writing embedded 
software. If you take a look at the software libraries for STM or Atmel 
microcontrollers, you will see tons of 'volatile' (or ARM CMSIS' synonym 
'__IO') around. All of the peripheral registers are defined like that, 
and there are many of them in a modern microcontroller.


The lack of 'volatile' probably means constant paranoia and never-ending 
work-arounds when porting multithreading code to FreePascal, or when 
writing embedded software with it. From what I have seen, it also means 
that the compiler will never be able to optimise across units, 
preventing the kind of global optimisation that GCC's LTO does. If you 
haven't got the time to make sure that everything a loop needs is inside 
the same unit, LTO can make a huge difference. Or did I get the wrong 
impression from FreePascal in this area?


Maintaining your own independent compiler is hard, and I would have 
expected that FreePascal had turned to GCC or LLVM a long time ago. 
There is some effort in the LLVM front, but without 'volatile' in the 
main compiler, LLVM is probably not going to fix this issue, at least in 
the short or medium term. I had a quick look, and there does not seem to 
be any documentation about the reason why the LLVM port was started. I 
wonder what other deficiencies are lurking in the main compiler at the 
moment, because it looks like FreePascal users will have to live with 
the "traditional" compiler for a long time to come.


A few years ago and gave Lazarus a try. At the time I just wanted to 
write a small, portable GUI, and I had trouble debugging with the IDE. I 
think it uses GDB under the hood, which tends to be problematic if not 
written to perfection (I have made the same experience with Emacs, DDD 
and others). It may have to do with driving GDB with text, instead of 
using it as a library. FreePascal's text-mode IDE doesn't even have a 
webpage (or at least I haven't found one).


Things like this do not encourage trust either:

"Debugging smart linked code might not work correctly. This is due to 
the fact that no type information is emitted for smartlinked code."


Therefore, before I delve any deeper: are there any other serious 
drawbacks that I should know about before I invest more time looking at 
FreePascal?


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


Re: [fpc-pascal] buggy debian package

2015-12-17 Thread Jonas Maebe

Mattias Gaertner wrote:


Debian has a FPC 3.0.0 package called "rc-buggy".

https://packages.debian.org/search?keywords=fpc=names=all=all

Is it just me, or does "buggy" sound a bit below awesome?


It's their alias for the "experimental" branch. Just like "sid" is 
"unstable", although that doesn't mean that all packages in sid are 
unstable.



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


Re: [fpc-pascal] Linker error

2015-12-17 Thread Jonas Maebe

Mattias Gaertner wrote:


What could be the cause of this linker error:

main.pp(6923,23) Warnung: Symbol "CommandLine" ist veraltet
/usr/bin/ld.bfd: warning: ../link.res contains output sections; did you forget 
-T?
/usr/bin/ld.bfd: /usr/lib/fpc/3.0.0/units/x86_64-linux/rtl/cprt0.o: 
unrecognized relocation (0x2a) in section `.text'
/usr/bin/ld.bfd: final link failed: Bad value


A buggy assembler? There is indeed no relocation type 42 for ELF/x86-64. 
Does that happen with the official FPC release? Does objdump -r 
/usr/lib/fpc/3.0.0/units/x86_64-linux/rtl/cprt0.o show any unknown 
relocation types?



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


[fpc-pascal] Linker error

2015-12-17 Thread Mattias Gaertner
Hi,

What could be the cause of this linker error:

main.pp(6923,23) Warnung: Symbol "CommandLine" ist veraltet
/usr/bin/ld.bfd: warning: ../link.res contains output sections; did you forget 
-T?
/usr/bin/ld.bfd: /usr/lib/fpc/3.0.0/units/x86_64-linux/rtl/cprt0.o: 
unrecognized relocation (0x2a) in section `.text'
/usr/bin/ld.bfd: final link failed: Bad value

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


[fpc-pascal] buggy debian package

2015-12-17 Thread Mattias Gaertner
Hi,

Debian has a FPC 3.0.0 package called "rc-buggy".

https://packages.debian.org/search?keywords=fpc=names=all=all

Is it just me, or does "buggy" sound a bit below awesome?

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