[fpc-devel] How to convert set to integer and vice versa

2014-07-22 Thread Gennady Agranov

Hi,

I am new to FPC, but I do like it - thanks!

We are trying to switch from Delphi to FPC, but I am stuck with the 
following issue - in Delphi you can cast set to integer and get it 
back later - again by casting. In our case it is used for persistence 
purposes.


We have a lot of different set types - i really do not want to write 
set-integer converter for every set type we have :(


Actually I did find a way - I use ^ and @ and cast pointers,
but is there a way to write general set-integer converter in FPC that 
I do not have to worry whether it will work or not?


And what actually -CPPACKSET=0 does - documentation is not clear - at 
least for me :)


Thanks,
Gennady
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] How to convert set to integer and vice versa

2014-07-22 Thread Gennady Agranov
On Tue, Jul 22, 2014 at 5:14 AM, Marco van de Voort mar...@stack.nl wrote:

 In our previous episode, Gennady Agranov said:
  I am new to FPC, but I do like it - thanks!
 
  We are trying to switch from Delphi to FPC, but I am stuck with the
  following issue - in Delphi you can cast set to integer and get it
  back later - again by casting. In our case it is used for persistence
  purposes.

 Good. And afaik in Delphi mode this works too in FPC? Did you test?


casting integer to set does not compile in FPC - and yes - I use Delphi
mode :(


  And what actually -CPPACKSET=0 does - documentation is not clear - at
  least for me :)

 The $PACKSET directive takes a numeric argument of 1, 2, 4 or 8.

 if you run fpc without parameters you get following:

  -CPx=y  packing settings
 -CPPACKSET=y y set allocation: 0, 1 or DEFAULT or NORMAL, 2, 4
and 8

I wonder what 0 means - thanks!

Not mentioned in the documentation means undefined.
 ___
 fpc-devel maillist  -  fpc-devel@lists.freepascal.org
 http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

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


Re: [fpc-devel] How to convert set to integer and vice versay

2014-07-22 Thread Gennady Agranov
Thanks!

Your example does compile, but if you replace 31 with 32 - it will not
compile - no matter what you use - integer, int64 or qword

And I guess I know the reason now - sizeof(left) should be equal to
sizeof(right) and 33 bits enum has sizeof of 5 :(

Any suggestions?

Thanks,
Gennady



On Tue, Jul 22, 2014 at 12:13 PM, Marco van de Voort mar...@stack.nl
wrote:

 In our previous episode, Gennady Agranov said:
  
   Good. And afaik in Delphi mode this works too in FPC? Did you test?
  
 
  casting integer to set does not compile in FPC - and yes - I use Delphi
  mode :(

 program setcast;

 {$ifdef FPC}
 {$mode delphi}
 {$else}
 {$APPTYPE CONSOLE}
 {$endif}

 uses
   SysUtils;

 type tenum=0..31;
  tmyset= set of tenum;

 var x:integer;
 y:tmyset;

 begin
   x:=integer(y);
 end.

 compiles in both FPC (both 2.6.x and trunk) and Delphi (XE4)

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

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


Re: [fpc-devel] How to convert set to integer and vice versay

2014-07-22 Thread Gennady Agranov
Thanks again!

I am all set now - I needed {$PACKSET 4} :)

Thanks,
Gennady

program setcast;
 {$ifdef FPC}
 {$mode delphi}
 {$PACKSET 4}
 {$else}
 {$APPTYPE CONSOLE}
 {$endif}
 uses
   SysUtils;
 type tenum=0..32;
  tmyset= set of tenum;
 var x:int64;
 y:tmyset;
 begin
   x:=int64(y);
 end.


On Tue, Jul 22, 2014 at 4:35 PM, Gennady Agranov gennadyagra...@gmail.com
wrote:

 Thanks!

 Your example does compile, but if you replace 31 with 32 - it will not
 compile - no matter what you use - integer, int64 or qword

 And I guess I know the reason now - sizeof(left) should be equal to
 sizeof(right) and 33 bits enum has sizeof of 5 :(

 Any suggestions?

 Thanks,
 Gennady



 On Tue, Jul 22, 2014 at 12:13 PM, Marco van de Voort mar...@stack.nl
 wrote:

 In our previous episode, Gennady Agranov said:
  
   Good. And afaik in Delphi mode this works too in FPC? Did you test?
  
 
  casting integer to set does not compile in FPC - and yes - I use Delphi
  mode :(

 program setcast;

 {$ifdef FPC}
 {$mode delphi}
 {$else}
 {$APPTYPE CONSOLE}
 {$endif}

 uses
   SysUtils;

 type tenum=0..31;
  tmyset= set of tenum;

 var x:integer;
 y:tmyset;

 begin
   x:=integer(y);
 end.

 compiles in both FPC (both 2.6.x and trunk) and Delphi (XE4)

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



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


Re: [fpc-devel] How to convert set to integer and vice versay

2014-07-22 Thread Gennady Agranov



But does that work in Delphi, did you test?


You are correct - Delphi also requires that source and target are of 
same size  - thanks!


I finally figured why existing Delphi code was not compiling - I did not 
use {$mode delphi} in the unit - i did not want to add {$mode dlephi} to

every file - so I used -Mdelphi in the fpc command line - it

program setcast;

type
  tenum = 0..63;
  tmyset= set of tenum;

var x:int64;
y:tmyset;

begin
   writeln(sizeof(tmyset));
   x:=int64(y);
   y := tmyset(x);

end.

If you compile this program fpc -Mdelphi setcast.pas - it will not 
complile :(

But if you add {$mode delphi} - it will :)

And I know why - if you have {$mode delphi}  - sizeof(tmyset) is 8, but 
if you do not (and use -Mdelphi)  sizeof(tmyset) is 32
Do you know why -Mdelphi  is different from {$mode delphi} w.r.t to 
sizeof(tmyset)?


Thanks,
Gennady


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


[fpc-devel] Question about local variables initialization

2014-09-19 Thread Gennady Agranov


Hi,

I do not have clear picture about initialization of local variables - 
are they initialized to some default value or not - and is there a way 
to assure that every local variable (including record types)  is set to 
some default?


Of course the safest approach is to assume that everything is not 
initialized and filled with garbage.


Is it always true? E.g. is there a way control initialization of record 
variables on stack?


Thanks,
Gennady

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


Re: [fpc-devel] Suggestion: reference counted objects

2014-09-20 Thread Gennady Agranov

Hi,

I will address multiple previous e-mails on  this subject :)

1. FPC does perform reference counting if variable type is interface, 
but not if variable type is class that implements interface - 
legacy/compatibility reasons?


If you want to do ARC for objects - just remove this limitation and 
allow compiler to generate reference counting code not just for for 
interfaces but for classes that implement interface - AFAIK any 
interface in FPC/Delphi extends IUnknown and has reference counting methods.


2. I agree with Sven - adding reference counting to TObject is a bad idea

Please do not look at Delphi - they just follow Apple - and both 
companies do not address real issues with their development tool chains 
- it is all pure marketing.


In reality ARC and weak keyword do not magically solve the memory 
management issues - you either have GC or you do not have GC - there is 
no way around it.


I personally like TComponent approach - you have an object that owns 
other objects - as soon as this object dies - all children and 
grandchildren die too.


Combining it with ARC seems to me the way to go...

3. About weak attribute - current strong approach with interface 
reference has a contract - it is either nil or pointer to valid instance.
If you mark interface reference as weak - how do you know whether this 
not nil reference is valid or not - I can be missing something here - 
please explain.


In Java weak reference is accessed through some intermediate object and 
you can this object whether the reference is gone or is still valid - 
but you need to have GC to do it...


Regards,
Gennady



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


Re: [fpc-devel] Suggestion: reference counted objects

2014-09-21 Thread Gennady Agranov
 I just want to remind you people (whoever is working on it) that 
ARC is already implemented in FPC for interface types and I am personally
 satisfited with the way /it works now/ for interface variables, and 
only wish that I could enable this feature for class instance variables.

 Can't someone just, you know, Ctrl+C  Ctrl+V it?

I assume you are talking about ARC for variables/fields of some class 
that implements interface?


Yes me, too!

Coming from Java I could not even comprehend at the beginning that if 
variable type is interface - it is reference counted, but if variable 
type is a class that implements interface - it is not ?!


Regards,
Gena

On 9/21/2014 2:02 PM, hinsta...@yandex.ru wrote:


I just want to remind you people (whoever is working on it) that ARC 
is already implemented in FPC for interface types and I am personally 
satisfited with the way /it works now/ for interface variables, and 
only wish that I could enable this feature for class instance 
variables. Can't someone just, you know, Ctrl+C  Ctrl+V it?



21.09.2014, 21:18, Boian Mitov mi...@mitov.com 
mailto:mi...@mitov.com:


 In general I would prefer to see this implemented with attributes
rather
 than with new keywords. For god shake, we already have more
keywords in this
 language than it is healthy. We should be extremely cautions when
adding new
 ones.
 That is one of the beauty of the attributes. They can eliminate a
large
 number of keywords, and expand the language dynamically (trough
the library
 not trough the compiler).
 If you implement it with attributes, there is almost no need for
any big
 changes in the compiler at least in the parsing side. Adding new
keyword
 will probably propagate all the way to the tokenizer.

 With best regards,
 Boian Mitov

 ---
 Mitov Software
www.mitov.com http://www.mitov.com/
 ---
 -Original Message-
 From: Sven Barth
 Sent: Sunday, September 21, 2014 4:12 AM
 To: fpc-devel@lists.freepascal.org
mailto:fpc-devel@lists.freepascal.org
 Subject: Re: [fpc-devel] Suggestion: reference counted objects

 === code begin ===

 type
TARCObject = class refcounted(TObject)

end;

 === code end ===

 === code begin ===

 type
TSomeClass = class(TARCObject)
  // ...
  Owner: TSomeClass weak;
  // ...
end;

 === code end ===

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



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


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


[fpc-devel] IComparer vs CompareFunc

2014-11-24 Thread Gennady Agranov
Hi,

I am trying to have some code that uses generics to compile under Delphi
and under FPC (uses fgl)

In Delphi I pass IComparerT and in FPC TCompareFuncT

IComparerT is an object and I can create it with some state that compare
method can use :)

In FPC I should pass function:

TCompareFunc = function(const Item1, Item2: T): Integer;

And I am not sure where I can add my state information that compare will
use - it is not and object function :(

Any help will be appreciated!

Thanks,
Gennady
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


[fpc-devel] What is the status of fpc generics.collections.

2014-11-24 Thread Gennady Agranov
Hi,

I have found the old announcement about fpc-generics-collections, but all
links are broken...

What is the status of this project?

Is it still downloadable?

Thank you,
Gennady
 [fpc devel] Library announcement: Generics.Collections
https://www.mail-archive.com/search?l=fpc-devel@lists.freepascal.orgq=subject:%22%5Bfpc-devel%5D+Library+announcement%3A+Generics.Collections%22

Maciej Izak
https://www.mail-archive.com/search?l=fpc-devel@lists.freepascal.orgq=from:%22Maciej+Izak%22
Wed,
22 May 2013 12:45:20 -0700
https://www.mail-archive.com/search?l=fpc-devel@lists.freepascal.orgq=date:20130522

Hi Free Pascal community!

I'm pleased to announce the generic library, compatible with Delphi
Generics.Collections (almost ;) ).

Homepage
https://code.google.com/p/fpc-generics-collections/

SVN
http://fpc-generics-collections.googlecode.com/svn/trunk/


=== modules ===

  Generics.Defaults
  Generics.Collections
  Generics.Helpers
  Generics.Hashes

=== compatible classes ===

  TEnumeratorT
  TEnumerableT
  TListT
  TQueueT
  TStackT
  TDictionaryTKey, TValue
  TObjectListT: TObject
  TObjectStackT: TObject
  TObjectDictionaryTKey, TValue

=== renamed (because compiler limations/bug) ===

  TArrayHelperT instead of TArrayT

=== additional classes ===
  
  TDictionaryTKey, TValue, TProbeSequence, THash, THashFactory
  TObjectDictionaryTKey, TValue, TProbeSequence, THash, THashFactory

TKey - key, TValue - value, THashFactory - hash factory :)
TProbeSequence - TProbeSequence is special record for open addresing.
To choose from a predefined:
  TLinearProbing, TQuadraticProbing, TDoubleHashing,
  TFastLinearProbing, TFastQuadraticProbing, TFastDoubleHashing (fast
version is without mod)
  more info at http://en.wikipedia.org/wiki/Open_addressing
THash - type for hash (to reduce size of dictionary - can be UInt8,
UInt16, UInt32 etc.)

For example, Delphi TDictionary version in this library is defined as:
TDictionaryTKey, TValue = class(TDictionaryTKey, TValue,
TFastLinearProbing, UInt32, TDelphiHashFactory);
  
  TDictionaryListTKey, TValue, TIndex, THash, THashFactory
class, that combines a TList and TDictionary

TKey - key, TValue - value, THashFactory - hash factory :)
TIndex - type for index (to reduce size of dictionary - can be UInt8,
UInt16, UInt32 etc.)
THash - type for hash (to reduce size of dictionary - can be UInt8,
UInt16, UInt32 etc.)
  
  Similar to TList, TDictionary and TDictionaryList, but uses normal
operators instead of IEqualityComparer.

  TFastList
  TFastDictionary
  TFastDictionaryList
  
  TFastArrayHelperT - similar rules as above

=== not implemented ===

  TThreadedQueueT

=== FAQ ===

1. How to use record as Key or Value in dictionary?

  You need to wait for some compiler magic ( system functions
GetReferenceToValue and GetValueSize described bolow)
  or add two methods to record:

TRecord = record
  (* ... *)
  function GetValueSize: Integer; inline;
  function GetReferenceToValue: Pointer; inline;
end;

2. How to use Pointer or some custom type as Key or Value in dictionary?

  You need to wait for some compiler magic ( system functions
GetReferenceToValue and GetValueSize described bolow)
  or use TValueHelper:

uses
  Generics.Collections, Generics.Helpers;
(* ... *)
  type
TValueHelperPointer = TValueHelperPointer;
  var
d: TDictionaryTValueHelperPointer, string;
  begin
(* ... *)
d.Add(nil, 'foo');

=== TODO ===

Comparer from Generics.Defaults can be optimized.

I have no knowledge of FPC compiler design, so i need a little help...

First thing : To finish my work I need critical compiler magic
functions/feature. At first look mayby there is no sense for this functions
but during work on Generic library it's necessary:

  function GetReferenceToValue(Value: T): Pointer; // for string types
return @s[1] or nil for empty string for Int32 return @i etc. returns a
reference to the value, as

measured by human/programmer
  function GetValueSize(Value: T): Integer; // for string types return
Length(s), for Int32 returs 4 etc.

This functions should be implemented as operators (like Inc, Dec operators).

There is half-workaround/cripled solution as record/type helpers (module
Generics.Helpers). Don't work for custom strings, and for custom basic
types like:

  type MyStr = type string;
  type MyInt = type Int32;

Second thing: Bugs. Look at Critical - fix is needed to perform
compatibility with Delphi and proper work.

  http://bugs.freepascal.org/view.php?id=24283 (CRITICAL! Very
Important!)
  http://bugs.freepascal.org/view.php?id=24282 (CRITICAL! Very
Important!)
  http://bugs.freepascal.org/view.php?id=24254 (CRITICAL! for
TArray.SortT)
  http://bugs.freepascal.org/view.php?id=24287 (Very Important!)
  http://bugs.freepascal.org/view.php?id=24072 (Very Important!)
  

[fpc-devel] can't build trunk for x86_64-linux (suse-64)

2014-11-24 Thread Gennady Agranov
suse-32 builds fine though ...

Anything obvious I have missed?

Thanks,
Gennady

Start compiling package gdbint for target x86_64-linux.
File libgdb.a not found
   Compiling gdbint/src/gdbint.pp
   Compiling gdbint/src/gdbcon.pp
   Compiling gdbint/src/gdbver.pp
   Linking gdbint/bin/x86_64-linux/gdbver
The installer encountered the following error:
External command /home/agranov/fpc/compiler/ppcx64 -Tlinux
-FEgdbint/bin/x86_64-linux -FUgdbint/units/x86_64-linux/
-Fu/home/agranov/fpc/rtl/units/x86_64-linux/ -Figdbint/src
-Fl/usr/lib64/gcc/x86_64-suse-linux/4.8 -Ur -Xs -O2 -n
-Fu/home/agranov/fpc/rtl/units/x86_64-linux -Cg -dx86_64 -dRELEASE -XX -CX
-viq gdbint/src/gdbver.pp failed with exit code 256. Console output:
Target OS: Linux for x86-64
Compiling gdbint/src/gdbver.pp
Linking gdbint/bin/x86_64-linux/gdbver
gdbver.pp(104,1) Error: Error while linking
gdbver.pp(104,1) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
/usr/bin/ld: warning: gdbint/bin/x86_64-linux/link.res contains output
sections; did you forget -T?
/usr/bin/ld: cannot find libgdb.a
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


[fpc-devel] Question about 2.7.1 graduation

2014-11-25 Thread Gennady Agranov
Hi,

When can regular FPC user expect 2.7.1 to graduate and be marked as stable
release?

Somewhere in Spring - like 2.6.4?

Thanks,
Gennady
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


[fpc-devel] Question about building fpc for linux_x86 vs linux_x64

2014-12-28 Thread Gennady Agranov

Hi,

I have built FPC from trunk - thanks to fpcup!!!

For linux_x64 it built as is - great!

For linux_x86 I had to add dependencies for rtl-objpas, rtl-extras, 
rtl-console and fcl-base to the following packages:


M   ide/fpmake.pp
M   utils/fpdoc/fpmake.pp
M   utils/fpmake.pp
M   utils/fppkg/fpmake.pp
M   utils/pas2jni/fpmake.pp
M   utils/pas2ut/fpmake.pp
M   utils/unicode/fpmake.pp

What I do not understand is the following - why these missing 
dependencies were not required for linux_x64?


Thanks,
Gennady

PS. I can submit changes (i guess?) or send a patch file if somebody 
needs it.


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


Re: [fpc-devel] Question about building fpc for linux_x86 vs linux_x64

2014-12-28 Thread Gennady Agranov
 No, you do not have enough permissions to commit. But can you send 
the patch, so that I can see what you've changed?


output of svn diff attached :)

Thanks,
Gennady



Regards,

Joost.

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



Index: ide/fpmake.pp
===
--- ide/fpmake.pp   (revision 29352)
+++ ide/fpmake.pp   (working copy)
@@ -158,7 +158,11 @@
 P.Directory:=ADirectory;
 {$endif ALLPACKAGES}
 
+P.Dependencies.Add('fcl-base');
+P.Dependencies.Add('fcl-xml');
 P.Dependencies.Add('rtl-extra');
+P.Dependencies.Add('rtl-console');
+P.Dependencies.Add('rtl-objpas');
 P.Dependencies.Add('fv');
 P.Dependencies.Add('chm');
 { This one is only needed if DEBUG is set }
Index: utils/fpdoc/fpmake.pp
===
--- utils/fpdoc/fpmake.pp   (revision 29352)
+++ utils/fpdoc/fpmake.pp   (working copy)
@@ -30,6 +30,7 @@
 P.Dependencies.Add('fcl-xml');
 P.Dependencies.Add('fcl-passrc');
 P.Dependencies.Add('fcl-process');
+P.Dependencies.Add('rtl-objpas');
 P.Dependencies.Add('chm');
 P.Dependencies.Add('univint',[darwin,iphonesim]);
 
Index: utils/fpmake.pp
===
--- utils/fpmake.pp (revision 29352)
+++ utils/fpmake.pp (working copy)
@@ -63,6 +63,7 @@
 
 P.Dependencies.Add('fcl-base');
 P.Dependencies.Add('paszlib');
+   P.Dependencies.Add('rtl-objpas');
 P.Dependencies.Add('hash');
 P.Dependencies.Add('univint',[darwin,iphonesim]);
 
Index: utils/fppkg/fpmake.pp
===
--- utils/fppkg/fpmake.pp   (revision 29352)
+++ utils/fppkg/fpmake.pp   (working copy)
@@ -40,6 +40,8 @@
 P.Dependencies.Add('fcl-process');
 P.Dependencies.Add('fcl-net');
 P.Dependencies.Add('paszlib');
+P.Dependencies.Add('rtl-extra');
+P.Dependencies.Add('rtl-objpas');
 
//P.Dependencies.Add('libcurl',[beos,haiku,freebsd,darwin,iphonesim,solaris,netbsd,openbsd,linux,aix]);
 P.Dependencies.Add('fppkg');
 P.Dependencies.Add('univint', [Darwin, iphonesim]);
Index: utils/pas2jni/fpmake.pp
===
--- utils/pas2jni/fpmake.pp (revision 29352)
+++ utils/pas2jni/fpmake.pp (working copy)
@@ -29,6 +29,7 @@
 P.Dependencies.Add('fcl-base');
 P.Dependencies.Add('fcl-process');
 P.Dependencies.Add('fcl-json');
+P.Dependencies.Add('rtl-objpas');
 
 T:=P.Targets.AddImplicitUnit('def.pas');
 T.Install := false;
Index: utils/pas2ut/fpmake.pp
===
--- utils/pas2ut/fpmake.pp  (revision 29352)
+++ utils/pas2ut/fpmake.pp  (working copy)
@@ -26,6 +26,7 @@
 
 P.Directory:=ADirectory;
 P.Version:='2.7.1';
+P.Dependencies.Add('fcl-base');
 P.Dependencies.Add('fcl-passrc');
 
 T:=P.Targets.AddProgram('pas2ut.pp');
Index: utils/unicode/fpmake.pp
===
--- utils/unicode/fpmake.pp (revision 29352)
+++ utils/unicode/fpmake.pp (working copy)
@@ -27,6 +27,7 @@
 {$endif ALLPACKAGES}
 P.Version:='2.7.1';
 P.Dependencies.Add('rtl');
+P.Dependencies.Add('rtl-objpas');
 P.Dependencies.Add('fcl-base');
 P.Dependencies.Add('fcl-xml');
 
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] Question about building fpc for linux_x86 vs linux_x64

2014-12-28 Thread Gennady Agranov
 1. Sounds like fpmake doesn't recursively add dependencies? e.g. 
rtl-objpas should come as dep of fcl-base.
 2. if the patch just adds ALL those dependencies to all those 
packages, are they really tested as being really required for all of those?


I knew that I should be more verbose in my original e-mail - my apologies...

No, there was no need to add ALL dependencies - *rtl-objpas, rtl-extras, 
rtl-console and fcl-base* to ALL fpmake instances:


M   ide/fpmake.pp
M   utils/fpdoc/fpmake.pp
M   utils/fpmake.pp
M   utils/fppkg/fpmake.pp
M   utils/pas2jni/fpmake.pp
M   utils/pas2ut/fpmake.pp
M   utils/unicode/fpmake.pp

I was adding dependencies one by one - after compilation error about 
unresolved used unit I was looking for the package that contains this 
unit and adding the missing dependency - for every compilation error and 
for every fpmake instance.


But all these added dependencies were from this list...

It is not a big deal, though it took several iterations.

What I really want to understand (or get some opinion) - why linux_x64 
build did not have these issues


BTW - one of the missing units was variants (from rtl-objpas)

And you were already fixing similar issue in different fpmake.pp - 
http://bugs.freepascal.org/view.php?id=26630



 Fixed by adding rtl-objpas to dependencies.
 Don't understand though why this doesn't lead to problems under 
supported (2.6.4) circumstances.

 Variants usage is in fpjson from the beginning since rev r85xx

So the mystery continuous :)

Thanks,
Gennady

PS. I probalbly should have compare build logs between linux_x86 and 
linux_x64...




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


Re: [fpc-devel] Question about building fpc for linux_x86 vs linux_x64

2014-12-28 Thread Gennady Agranov
 1. Sounds like fpmake doesn't recursively add dependencies? e.g. 
rtl-objpas should come as dep of fcl-base.


I am not familar at all with fpmake design - if fcl-base depends on 
rtl-objpas - does it mean that rtl-objpas dependency is exported - 
i.e. -Fu to rtl-objpas will be added if only fcl-base dependency is 
added in fpmake.pp?


I had to add dependency to rtl-objpas in several fpmake instances - even 
though fcl-base was already there :(


On 12/28/2014 5:49 PM, Marco van de Voort wrote:

In our previous episode, Joost van der Sluis said:

What I do not understand is the following - why these missing
dependencies were not required for linux_x64?

What I do not understand is why you needed theses changes in the first
place? Can you send the commands you used to compile fpc, and the last
part of the output?


PS. I can submit changes (i guess?) or send a patch file if somebody
needs it.

No, you do not have enough permissions to commit. But can you send the
patch, so that I can see what you've changed?

In addition my observations:

1. Sounds like fpmake doesn't recursively add dependencies? e.g. rtl-objpas
should come as dep of fcl-base.
2. if the patch just adds ALL those dependencies to all those packages, are
they really tested as being really required for all of those?

E.g. I can't imagine rtl-console be needed for so many of them.
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel



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


[fpc-devel] Question about runtime error 219

2015-01-09 Thread Gennady Agranov

Hi All,

What exactly -CR (Verify object method call validity) code generation is 
checking and how tested is it?


For debugging I prefer to enable all possibles checks - range, overflow, ...

But i can not use -CR:

1. I passed some var array of array parameter - error 219 - changed to 
var array - works...


2. I use generics and 2.7.1 and when I am calling some method that is 
implemented in grandfather class - runtime error 219 :(


But, If I do not set -CR - everything works just fine...

Any internal scoop about -CR - please?

Thanks,
Gennady

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


[fpc-devel] ppudump question

2015-08-22 Thread Gennady Agranov

Hi,

1. I have code that heavily uses enums/sets

When I use ppudump to print  *.ppu files I see some sets reported with 
null ElType and I do not understand what causes them :(


And I do not believe that they are referenced at all...

Any ideas why set is reported with no ElType?

Thanks,
Gennady

Example:

json version:

  {
Type: set,
Id: 236,
Size: 1,
Base: 0,
Max: 0,
ElType: null
  },

text version:

** Definition Id 236 **
Set definition
  Type symbol : (7357) Nil
   DefOptions :
DefStates :
 Element type : (7361) Nil
 Size : 1
 Set Base : 0
  Set Max : 0

xml version:

 set
  id236/id
  size1/size
  base0/base
  max0/max
  eltype/eltype
/set


  {
Type: set,
Id: 92,
Size: 1,
Base: 0,
Max: 0,
ElType: null
  }

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


Re: [fpc-devel] ppudump question

2015-08-24 Thread Gennady Agranov

Thanks!

It was a great suggestion!

It is probably related to empty sets - but there is also something else 
- i have *.pp with []  passed as parameter but *.ppu does not mention 
set with empty ElType :(


Thanks again!

Gennady

On 8/24/2015 3:05 AM, Pierre Free Pascal wrote:

Maybe you are using empty sets in your source code?

An empty set:

[]

has no elements and thus the compiler cannot know what
the type of the elements are.

In the hope that this will help,

Pierre Muller



-Message d'origine-
De : fpc-devel-boun...@lists.freepascal.org [mailto:fpc-devel-
boun...@lists.freepascal.org] De la part de Gennady Agranov
Envoyé : dimanche 23 août 2015 00:46
À : fpc-devel@lists.freepascal.org
Objet : [fpc-devel] ppudump question

Hi,

1. I have code that heavily uses enums/sets

When I use ppudump to print  *.ppu files I see some sets reported with
null ElType and I do not understand what causes them :(

And I do not believe that they are referenced at all...

Any ideas why set is reported with no ElType?

Thanks,
Gennady

Example:

json version:

{
  Type: set,
  Id: 236,
  Size: 1,
  Base: 0,
  Max: 0,
  ElType: null
},

text version:

** Definition Id 236 **
Set definition
Type symbol : (7357) Nil
 DefOptions :
  DefStates :
   Element type : (7361) Nil
   Size : 1
   Set Base : 0
Set Max : 0

xml version:

   set
id236/id
size1/size
base0/base
max0/max
eltype/eltype
  /set


{
  Type: set,
  Id: 92,
  Size: 1,
  Base: 0,
  Max: 0,
  ElType: null
}

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

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



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


Re: [fpc-devel] Can FPC at least give a hint/warning?

2016-11-08 Thread Gennady Agranov

Hi,


Or what are the conditions when you want to emit the hint?


I thought that hint could come from some layer that actually allocates 
the record - on the stack or on the heap - this layer may actually know 
the "effective" alignment


Heap allocation should be aligned to the largest required alignment (is 
it 8?) - i.e. it should relatively simple to validate that offset of 
some "double" field is properly aligned


I actually do not know how stack allocation works - i.e. when and how 
compiler aligns double, extended or record values (packed or unpacked)


So if in your opinion this hint would report too many false positives - 
case is closed :)


>>> if the bug is closed - is there any way to add a note to it?

Yes, I found this button after I have went to the URL again and 
inspected the available UI  more thorough :(

I did not want to send another e-mail to FPC list - that I have found it :)

Sorry about it,
Gennady
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


[fpc-devel] Can FPC at least give a hint/warning?

2016-11-06 Thread Gennady Agranov

Hi,

I have submitted a bug - http://bugs.freepascal.org/view.php?id=30872 
(misaligned data exception on ARMv7)


And this big was resolved as "won't fix"

1. I understand that one has to work really hard to encounter this bug - 
and there are easy workarounds, but it there are also different ways to 
resolve this bug - e.g. just giving a hint would suffice - IMHO


2. All our units use {$PACKRECORDS 1} in order to be layout compatible 
with Delphi and we always can add padding or change the field order - if 
only compiler warned us that field is not properly aligned for the 
target platform...


3. And a separate question - if the bug is closed - is there any way to 
add a note to it?


Thank you very much,

Gennady





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


Re: [fpc-devel] About building JNI library for arm-linux

2016-10-31 Thread Gennady Agranov
I thought that "reply" and changing the subject to a new one will do the 
trick...


Is "topic" stored somewhere in the mail headers?

Sorry,
Gennady

On 10/31/2016 4:42 PM, wkitt...@windstream.net wrote:

On 10/31/2016 04:01 PM, Gennady Agranov wrote:

Hi,

I have an issue with loading JNI library for Raspberry :(


what does this have to do with the "A generic function for (multicore) 
cache flush?" topic you attached it to by replying to that topic? you 
should use the [write] or [post] button and then type in the name of 
the mailing list or news group... then the subject and the post 
instead of trying to take shortcuts and hijacking a topic...




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


[fpc-devel] About building JNI library for arm-linux

2016-10-31 Thread Gennady Agranov

>>> Why do you use LCL in your JNI library?
>>> Try a simple library without LCL and check if it loads.

It works!

Great Thanks!

Does anyone know what to do about:

Java HotSpot(TM) Client VM warning: You have loaded library 
/media/pi/Transcend/cypress-release/pas2jni_policing64/policing64/policing.so 
which might have disabled stack guard. The VM will try to fix the stack 
guard now.
It's highly recommended that you fix the library with 'execstack -c 
', or link it with '-z noexecstack'.


Should I run execstack?

Should I run every time I build a shared object - or there is a better way?

Thanks!


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


[fpc-devel] About building JNI library for arm-linux

2016-10-31 Thread Gennady Agranov

Hi,

I have an issue with loading JNI library for Raspberry :(

I do compile with -Cg -WX and stack checking on (and also without).

But even this method is not called :(

function JNI_OnLoad(vm: PJavaVM; reserved: pointer): jint; {$ifdef 
linux}cdecl{$else}stdcall{$endif};

begin
  writeln('lll');
  exit(0);
end;

Any suggestions?

Thanks,
Gennady

Java HotSpot(TM) Client VM warning: You have loaded library 
/media/pi/Transcend/cypress-release/pas2jni_policing64/policing64/policing.so 
which might have disabled stack guard. The VM will try to fix the stack 
guard now.


It's highly recommended that you fix the library with 'execstack -c 
', or link it with '-z noexecstack'.


[FORMS.PP] ExceptionOccurred

  Sender=EStackOverflow

  Exception=Stack overflow

  Stack trace:

  $62E6CF48  fpc_stackcheck,  line 832 of 
/home/pi/development/fpc/rtl/inc/system.inc


TApplication.HandleException Stack overflow

  Stack trace:

  $62E6CF48  fpc_stackcheck,  line 832 of 
/home/pi/development/fpc/rtl/inc/system.inc


Exception at 62E6CF48: EStackOverflow:

Stack overflow.


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


Re: [fpc-devel] Problem with generic parameter

2017-01-01 Thread Gennady Agranov

Hi Sven,

Based on bug#20503 you are in charge of support for "generics"?
Thanks a lot for your work!

What about this incompatibility - is it a known issue?

{$ifdef FPC}
if 
Arrays.BinarySearch(changes.m_children,node,j,getComparatorByName) 
then

{$else}
if 
Arrays.BinarySearch(changes.m_children,node,j,getComparatorByName) 
then

{$endif}

Thanks,
Gennady

On 12/31/2016 1:25 PM, Sven Barth wrote:


Am 31.12.2016 10:33 schrieb "Дмитрий Померанцев" >:

>
> Welcome to five years old bug. :)
> http://bugs.freepascal.org/view.php?id=20503

Nope, that's not the same problem. Also the code example of the thread 
starter did not contain a generic method.


Regards,
Sven



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



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


[fpc-devel] Problem with generic parameter

2016-12-30 Thread Gennady Agranov

Hi,

Delphi mode, fpc 3.0.0

I have a Sort method:

type

  TArray = class

class procedure Sort(var Values: array of T; const Comparer: 
IComparer);


  end;

If I call Sort with some real type it compiles and works:

TArray.Sort(string,comparer);

but if i call it from another generic type - it does not compile:

class procedure Arrays.sort(var arr: array of T; const Comparer: 
IComparer);


begin

TArray.Sort(arr,comparer);

end;

Fatal: Syntax error, "CREATE" expected but "SORT" found

Anything I can do to make it compile?

Should I try objfp mode?

Thanks,

Gennady



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


Re: [fpc-devel] Why debugger does not "step in"?

2018-03-24 Thread Gennady Agranov
>>> It isn't a method of an "interface"? interfaces indeed have this 
issue.


It is the case - thanks!

Is it "nothing can be done about it" case?

Is there an already submitted bug?

Thanks,
Gennady

On 3/24/2018 4:42 AM, Martin Frb wrote:

On 24/03/18 02:24, Gennady Agranov wrote:

Hi,

I use FPC 3.0.4 / Lazarus 1.8.2

I am seeing the same behavior when I debug the program using Lazarus 
IDE under Win64 and Linux64


When I want to "step in" into my own function/procedure - GDB simply 
steps over...


If I set a breakpoint inside the function/procedure I want to "step 
in" and "run" - it would stop at this breakpoint. 


It isn't a method of an "interface"? interfaces indeed have this issue.

But if it is a normal procedure, then this is odd.  A few things you 
can try:


- On Windows, use an external linker (option -Xe)
- Try stabs vs Dwarf (Project Options > Debugging)
- Do NOT use smart linking
- Do NOT use any optimization -O...
- Try a diff version of gdb
- Try an older fpc (but keep all else the same). So you know if it is 
an issue with current fpc.


I also found a bug report 
https://bugs.freepascal.org/view.php?id=31599 that may or may not be 
related.


Someone recently reported they had the opposite problem, where the 
debugger would step in, when they actually stepped over. Not sure if 
related.

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



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


[fpc-devel] Why debugger does not "step in"?

2018-03-23 Thread Gennady Agranov

Hi,

I use FPC 3.0.4 / Lazarus 1.8.2

I am seeing the same behavior when I debug the program using Lazarus IDE 
under Win64 and Linux64


When I want to "step in" into my own function/procedure - GDB simply 
steps over...


If I set a breakpoint inside the function/procedure I want to "step in" 
and "run" - it would stop at this breakpoint.


I have all debug options enabled...

It is hard to debug if you can't "step in".

Do I miss some settings?

Thanks,

Gennady






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


Re: [fpc-devel] Array assignment operator

2018-11-03 Thread Gennady Agranov

Hi,

Leaving aside the reason why the MiSchi's solution doesn't work the main 
question is still not answered :)


If you have integer dynamic array "MyArray" is there a way for the 
following statement to compile and work correctly:


MyArray := 5;

Thanks,
Gennady


On 11/3/2018 4:14 PM, Ben Grasset wrote:
On Sat, Nov 3, 2018 at 8:01 AM Schindler Karl-Michael 
mailto:karl-michael.schind...@web.de>> 
wrote:


Hi

I would like to use a simple assignment operator for arrays, with
which all elements of an array are assigned to the same value,
similar to an extended initialize, not to zero but to a value of
choice. A simple example for an integer array would be:

  myArray := 5;

With arrays with defined bounds, it works, but i was not able to
do it with a dynamic array. My test case is this:

program arrayAssign;

type
  TmyArray = array of integer;

var
  myArray: TmyArray;
  index: integer;

operator := (const number: integer) theResult: TmyArray;
  var
    i: integer;
  begin
    for i := low(theResult) to high(theResult) do
      theResult[i] := number;
  end;

begin
  setlength(myArray, 10);
  writeln ('myArray: ', low(myArray), ', ', high(myArray));

  myArray := 5;

  writeln ('myArray: ', low(myArray), ', ', high(myArray));
  for index := low(myArray) to high(myArray) do
    writeln (index, ': ', myArray[index]);
end.

The output is:

myArray: 0, 9
myArray: 0, -1

The problem is that in the declaration of the operator, the
functions low and high seem to return the values of the type
TmyArray, i.e. 0 and -1 and not the values of the variable of the
assignment statement, i.e. myArray and the assignment nullifies
the previous setlength. Is there any way around this and obtain
the actual values of myArray?

Michael, aka MiSchi.
___
fpc-devel maillist  - fpc-devel@lists.freepascal.org

http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


There's two issues:
1) The result of the operator is always a new, unique array (as in 
it's unrelated to the myArray variable)
2) Your operator doesn't initialize the result with a length, so it's 
just iterating over nothing.


Here's an example of the correct way to write the operator and use it:

program ArrayOverloads;

{$mode ObjFPC}

type TIntArray = array of Integer;

  operator := (const I: Integer): TIntArray; inline;
  var V: Integer;
  begin
    SetLength(Result, I);
    for V := 0 to Pred(I) do Result[V] := V;
  end;

var
  I: Integer;
  IA: TIntArray;

begin
  IA := 25;
  for I in IA do Write(I, ' ');
  WriteLn;
  for I := High(IA) downto 0 do Write(I, ' ');
  WriteLn;
  for I := Low(IA) to High(IA) do Write(I, ' ');
  WriteLn;
  I := 0;
  while I < Pred(High(IA)) do begin
    Inc(I, 2);
    Write(I, ' ');
  end;
end.

Output:

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
2 4 6 8 10 12 14 16 18 20 22 24


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



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


Re: [fpc-devel] Array assignment operator

2018-11-04 Thread Gennady Agranov

On 11/4/2018 11:24 AM, Sven Barth via fpc-devel wrote:
Am So., 4. Nov. 2018, 12:23 hat Schindler Karl-Michael 
mailto:karl-michael.schind...@web.de>> 
geschrieben:




> Am 04.11.2018 um 12:00 schrieb Ben Grasset mailto:operato...@gmail.com>>:
>
> From: Ben Grasset mailto:operato...@gmail.com>>
> To: FPC-Devel users discussions mailto:fpc-devel@lists.freepascal.org>>
> Subject: Re: Array assignment operator
> Message-ID:
mailto:cal4d7fjpfx-yst6z3--fhpr9pts-n47ksfn6m2phd7sunzw...@mail.gmail.com>>
> Content-Type: text/plain; charset="utf-8"
>
> On Sat, Nov 3, 2018 at 4:44 PM Gennady Agranov
mailto:gennadyagra...@gmail.com>>
> wrote:
>
>> Hi,
>>
>> Leaving aside the reason why the MiSchi's solution doesn't work
the main
>> question is still not answered :)
>>
>> If you have integer dynamic array "MyArray" is there a way for the
>> following statement to compile and work correctly:
>>
>> MyArray := 5;
>>
>
> Uh, yes? That's what my example showed.

In your example the length of the array was set to the number and
the elements of the array assigned to their index, whereas my
intention is to keep the length of the array and fill all elements
to the same number.


The operator always creates a new array and does not modify the 
existing one.

You'd need to abuse a binary operator (e.g. >< or even <=) for this.

Regards,
Sven



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


I was thinking that type helper might work - e.g. MyArray.SetValue(5) 
and with using properties MyArray.Value := 5


But seems that even simple type helper is not working anymore?

E.g. I was not able to compile example from 
http://wiki.freepascal.org/Helper_types :(


TTypeHelper=  type  helperfor  Integer
  procedure  SetZero;
end;

Thanks,

Gennady



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


Re: [fpc-devel] Array assignment operator

2018-11-04 Thread Gennady Agranov

On 11/4/2018 5:24 PM, Sven Barth via fpc-devel wrote:
Am So., 4. Nov. 2018, 20:36 hat Gennady Agranov 
mailto:gennadyagra...@gmail.com>> geschrieben:


On 11/4/2018 11:24 AM, Sven Barth via fpc-devel wrote:

Am So., 4. Nov. 2018, 12:23 hat Schindler Karl-Michael
mailto:karl-michael.schind...@web.de>> geschrieben:



> Am 04.11.2018 um 12:00 schrieb Ben Grasset
mailto:operato...@gmail.com>>:
>
> From: Ben Grasset mailto:operato...@gmail.com>>
> To: FPC-Devel users discussions
mailto:fpc-devel@lists.freepascal.org>>
> Subject: Re: Array assignment operator
> Message-ID:
mailto:cal4d7fjpfx-yst6z3--fhpr9pts-n47ksfn6m2phd7sunzw...@mail.gmail.com>>
> Content-Type: text/plain; charset="utf-8"
>
> On Sat, Nov 3, 2018 at 4:44 PM Gennady Agranov
mailto:gennadyagra...@gmail.com>>
> wrote:
>
>> Hi,
>>
>> Leaving aside the reason why the MiSchi's solution doesn't
work the main
>> question is still not answered :)
>>
>> If you have integer dynamic array "MyArray" is there a way
for the
>> following statement to compile and work correctly:
>>
>> MyArray := 5;
>>
>
> Uh, yes? That's what my example showed.

In your example the length of the array was set to the number
and the elements of the array assigned to their index,
whereas my intention is to keep the length of the array and
fill all elements to the same number.


The operator always creates a new array and does not modify the
existing one.
You'd need to abuse a binary operator (e.g. >< or even <=) for this.

Regards,
Sven



___
fpc-devel maillist  -fpc-devel@lists.freepascal.org
<mailto:fpc-devel@lists.freepascal.org>
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


I was thinking that type helper might work - e.g.
MyArray.SetValue(5) and with using properties MyArray.Value := 5

But seems that even simple type helper is not working anymore?

E.g. I was not able to compile example from
http://wiki.freepascal.org/Helper_types :(

TTypeHelper=  type  helperfor  Integer
   procedure  SetZero;
end;

Did you add {$modeswitch typehelpers}?

If so, what is the error you get?

Regards,
Sven



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


My error was caused by the fact that I was using delphi mode - when I 
used the mode switch it worked perfectly :)


The original problem is solved - at least the way I see it - in FPC you 
can add method to the array :)


Cool!

Thanks!

{$MODESWITCH TYPEHELPERS}

program arrayset;

type
  abc = array of integer;
  abc_helper = type helper for abc
  procedure SetValue(value: integer);
  procedure Print;
end;

procedure abc_helper.SetValue(value: integer);
var
  i: integer;
begin
  for i := Low(self) to High(self) do
    self[i] := value;
end;

procedure abc_helper.Print;
var
  i: integer;
begin
  for i := Low(self) to High(self) do
    Writeln('[',i,'] = ',self[i]);
end;

var
  a: abc;
begin
  SetLength(a,10);
  a.SetValue(5);
  a.Print;
end.

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


[fpc-devel] Undefined symbol during linking - any suggestions?

2021-09-03 Thread Gennady Agranov via fpc-devel

Hi,

I have rather large program that fails to link - "Undefined symbol: .Lj3016"

The only difference with previous cases when link was successful is that 
I added "indylaz" package - not sure if there is a connection...


What can I do or try to diagnose/resolve this issue?

(9022) Compiling resource lib\x86_64-win64\configserver.obj

(9015) Linking .\configserver.exe

Error: Undefined symbol: .Lj3016

Fatal: (10026) There were 1 errors compiling module, stopping

Fatal: (1018) Compilation aborted

Error: c:\lazarus\fpc\3.2.0\bin\x86_64-win64\ppcx64.exe returned an 
error exitcode


Thanks,

Gennady


___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] Undefined symbol during linking - any suggestions?

2021-09-08 Thread Gennady Agranov via fpc-devel

On 9/8/2021 2:25 PM, denisgolovan via fpc-devel wrote:

>>> Compiler builds release binaries fine.

What do you mean - it should work on "trunk"?

it is probably "generics" related, and i tried both official releases - 
3.2.0 and 3.2.2 - the same sad result


I suspect inlining did it as my code does not raise exception - but 
obviously i can be mistaken


.Lj3219:
    leaq RESSTR_$GENERICS.STRINGS_$$_SDICTIONARYKEYDOESNOTEXIST+8(%rip),%r8
    movq    $1,%rdx
    leaq    VMT_$CLASSES_$$_ELISTERROR(%rip),%rcx
*   call SYSUTILS$_$EXCEPTION_$__$$_CREATERES$PANSISTRING$$EXCEPTION*
    movq    %rax,%rcx
    leaq    .Lj3222(%rip),%rdx

How can one tell compiler to allow "inline" modifier, but ignore it?

Thanks,
Gena


I believe it's the same issue I have in 
https://gitlab.com/freepascal.org/fpc/source/-/issues/39140

Compiler builds release binaries fine.

-- Regards,
Denis Golovan
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel



___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] Undefined symbol during linking - any suggestions?

2021-09-07 Thread Gennady Agranov via fpc-devel

Thanks!

It did not help - both 3.0.2 and 3.2.2 when compile my code fail at the 
link phase


Target platform is Win64

Error: Undefined symbol: .Lj<4 digit number>

As I understand .Lj<4 digit number> is a label - not some external 
identifier


I guess I probably have too much code to link?

Are there some linker arguments I can add that would help?

Is it possible to specify some other linker?

Thanks,
Gennady


On 9/4/2021 5:09 AM, Bart via fpc-devel wrote:

On Sat, Sep 4, 2021 at 3:26 AM Gennady Agranov via fpc-devel
 wrote:

IIRC then there were som bugs regarding optimization in win64.
You can try to compile with optimizations disabled: -O- (or use the
Lazarus dialog to do so).



___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] Undefined symbol during linking - any suggestions?

2021-09-07 Thread Gennady Agranov via fpc-devel

Hi,

linker complains about undefined symbol  .Lj3016

I checked *.s files and found that one file has no label .Lj3016 but has 
following line:


    leaq   .Lj3016(%rip),%rdx

Am I correct that that this *.s file should also have a label?

Thanks,
Gena

On 9/4/2021 5:09 AM, Bart via fpc-devel wrote:

On Sat, Sep 4, 2021 at 3:26 AM Gennady Agranov via fpc-devel
 wrote:

IIRC then there were som bugs regarding optimization in win64.
You can try to compile with optimizations disabled: -O- (or use the
Lazarus dialog to do so).



___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


[fpc-devel] RTTI status in 3.2.0 and 3.2.2

2021-09-17 Thread Gennady Agranov via fpc-devel

Hi,

I have Delphi RTTI code that takes record's type info, finds method and 
calls it...


The code does not seem to work in 3.2.0 (SEGV)

Should it work?

Should I try 3.2.2 or there are other ways to call record method in FPC?

Thanks,

Gennady



___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] RTTI status in 3.2.0 and 3.2.2

2021-09-22 Thread Gennady Agranov via fpc-devel

Cool!
Thanks!

Gennady

On 9/20/2021 11:53 AM, Ryan Joseph via fpc-devel wrote:



On Sep 19, 2021, at 7:01 AM, Sven Barth via fpc-devel 
 wrote:

No, this is not yet supported, but it's a work in progress, but it will arrive 
the earliest with 3.4 which is not yet planned.


We're nearly finished with right now so it could appear in the trunk version 
within a month or so even.

Regards,
Ryan Joseph

___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel



___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel