Re: [fpc-pascal] External library name

2025-01-05 Thread Tony Whyman via fpc-pascal
Having stumbled over this problem last year, I now have a very simple rule (and which seems to work). If you are linking with an external static library (e.g. libssl.a) then you omit the external library name on each function call, but must include a $LINKLIB e.g. ($LINKLIB ssl.a}. If you ar

Re: [fpc-pascal] Custom NewInstance allocator

2024-06-05 Thread Tony Whyman via fpc-pascal
You may find that compiling with "{$OBJECTCHECKS OFF}" allows your program to run and as long as your object has  no virtual methods nor  does it require its fields to be initialised to zero, then it might even give a useful result - otherwise, you also need to call InitInstance. On 04/06/2024

Re: [fpc-pascal] FPC 3.3.x breaks the Firebird Project's Firebird.pas

2024-05-04 Thread Tony Whyman via fpc-pascal
Firebird 2.5 and misses many important features), keeping with the old version of the compiler, or just moving to Delphi. And, before going down this path, perhaps you might like to give a heads up of what other changes are in the pipeline that may knowing break interfaces to other programming env

[fpc-pascal] FPC 3.3.x breaks the Firebird Project's Firebird.pas

2024-05-02 Thread Tony Whyman via fpc-pascal
at I can suggest to the Firebird Devs to make generally available. Tony Whyman MWA Software ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] client certificate mandatory and verification

2024-04-10 Thread Tony Whyman via fpc-pascal
If you want to use OpenSSL then you might be interesting in trying out my proposed update to the Indy components. This is to support the latest versions of OpenSSL and can be downloaded from: https://github.com/MWASoftware/Indy.proposedUpdate There is a test case in Test/OpenSSL/openssl-server

[fpc-pascal] Can FPC link a program with static (.a) libraries on Windows

2024-02-16 Thread Tony Whyman via fpc-pascal
I have a Pascal program, compiled with FPC 3.2.2 and which appears to happily link and run with a static library compiled with gcc and having a ".a" prefix on linux. The functions in the static library and declared as external functions using the "external name name>" directive. The "".a" libra

[fpc-pascal] RIP: Software design pioneer and Pascal creator Niklaus Wirth

2024-01-05 Thread Tony Whyman via fpc-pascal
"Swiss computer scientist Professor Niklaus Wirth died on New Year's Day, roughly six weeks before what would have been his 90th birthday." https://www.theregister.com/2024/01/04/niklaus_wirth_obituary/?utm_source=daily&utm_medium=newsletter&utm_content=top-article _

Re: [fpc-pascal] case statement

2023-12-16 Thread Tony Whyman via fpc-pascal
wonder why it was proposed. In normal English use, "else" is not used in this way. It usually follows another word, such as "anyone else", "anything else", "or else". You might say "If I go to town then I will be out. Otherwise, I will stay at

[fpc-pascal] Issue #39746 fpwidestring case conversion string too long

2023-09-25 Thread Tony Whyman via fpc-pascal
This issue seems to be still open after one year. There was a proposed fix: https://gitlab.com/freepascal.org/fpc/source/-/merge_requests/158. However the discussion seems to tail off without an obvious resolution. This is a clear bug in fpwidestring and needs to be fixed. What is the status?

Re: [fpc-pascal] I am offering a $100 reward for linking static libraries

2022-08-23 Thread Tony Whyman via fpc-pascal
t := Trunc(f); end; As long as you can reduce the missing dependencies to a relatively small number, it should all work. Regards Tony Whyman MWA On 21/08/2022 18:34, Anthony Walter via fpc-pascal wrote: I will pay $100 to the first person that can solve my problem of linking a compiled C stat

Re: [fpc-pascal] Repost: TFieldType declaration change in FPC fixes_3_2 branch

2021-10-17 Thread Tony Whyman via fpc-pascal
Yes - but is that really a bug fix that justifies a non-backwards compatible change? On 17/10/2021 11:09, Michael Van Canneyt via fpc-pascal wrote: On Sun, 17 Oct 2021, Tony Whyman via fpc-pascal wrote: /Reposted with correct branch identifier/. I thought that a fixes branch was only for

[fpc-pascal] Repost: TFieldType declaration change in FPC fixes_3_2 branch

2021-10-17 Thread Tony Whyman via fpc-pascal
heard the same for zeoslib. Is the rollout of this patch to fixes_3_2 a mistake, or is there a good reason for rolling out a change that breaks other packages? Tony Whyman MWA Software ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https

Re: [fpc-pascal] How to check if a network is available?

2021-06-18 Thread Tony Whyman via fpc-pascal
Yep, that's the golden rule in networking. The only way that you know that a bi-directional path is open is an end-to-end ping. Even then, you only know that it's open at the time the ping completed. If you are using TCP then you can always enable keepalive packets that effectively do the same

Re: [fpc-pascal] Sending Hex codes over TCP/IP

2020-09-11 Thread Tony Whyman via fpc-pascal
A TCP connection is no more than a pair of byte streams - one in each direction. You have to define your own structure for each byte stream and the procedures for use i.e. a protocol. lt will be easier if you can use a standard protocol such as http. An http POST is one way to send an array of b

Re: [fpc-pascal] Help with TList example

2020-09-08 Thread Tony Whyman via fpc-pascal
lf Of Tony Whyman via fpc-pascal Sent: Tuesday, September 8, 2020 7:21 AM To: fpc-pascal@lists.freepascal.org Cc: Tony Whyman Subject: Re: [fpc-pascal] Help with TList example Two observations: 1. In Pascal you should use "new" and "dispose" to allocate and deallocate reco

Re: [fpc-pascal] Help with TList example

2020-09-08 Thread Tony Whyman via fpc-pascal
Two observations: 1. In Pascal you should use "new" and "dispose" to allocate and deallocate record types - not GetMem and FreeMem. 2. MyRec is a pointer type and you should code the line as MyRec^.Value := tmp On 08/09/2020 12:10, James Richters via fpc-pascal wrote: I'm trying to figure

Re: [fpc-pascal] fpcmake packaging

2020-09-01 Thread Tony Whyman via fpc-pascal
On 01/09/2020 14:29, Ryan Joseph via fpc-pascal wrote: On Sep 1, 2020, at 7:46 PM, Tony Whyman via fpc-pascal wrote: fpcmake is a pre-processor that generates makefiles for fpc projects. You can use it to do just about anything a standard makefile can do, including including resource

Re: [fpc-pascal] fpcmake packaging

2020-09-01 Thread Tony Whyman via fpc-pascal
fpcmake is a pre-processor that generates makefiles for fpc projects. You can use it to do just about anything a standard makefile can do, including including resource files and running scripts. I use it all the time for building production versions of lazarus programs and prior to packaging th

Re: [fpc-pascal] FCL-DB Classes Implementation.

2019-10-31 Thread Tony Whyman
Then you might want to have a look at the IBX implementation of TIBArrayField. On 31/10/2019 08:09, Michael Van Canneyt wrote: On Wed, 30 Oct 2019, Kakoulidis Ioulianos wrote: Are there plans to implement TArrayField, TADTField, TReferenceField, TDatasetField classes in fcl-db package? Y

Re: [fpc-pascal] Read lines into UnicodeString variable from UCS2 (UTF-16) encoded text file

2019-09-05 Thread Tony Whyman
Hajny wrote: On 2019-09-05 10:24, Tony Whyman wrote: A few points: 1. IMHO: This is currently a Windows problem where the console buffer is UCS2. Linux (and probably all other cases its UTF8 - to be verified).  .  . No, the subject refers to text files, not to console. Obviously, console output ha

Re: [fpc-pascal] Read lines into UnicodeString variable from UCS2 (UTF-16) encoded text file

2019-09-05 Thread Tony Whyman
Apologies: when I typed "FTP" below I meant "FPC" :( I'm currently drowning in acronym soup. On 05/09/2019 09:24, Tony Whyman wrote: A few points: 1. IMHO: This is currently a Windows problem where the console buffer is UCS2. Linux (and probably all other cases

Re: [fpc-pascal] Read lines into UnicodeString variable from UCS2 (UTF-16) encoded text file

2019-09-05 Thread Tony Whyman
A few points: 1. IMHO: This is currently a Windows problem where the console buffer is UCS2. Linux (and probably all other cases its UTF8 - to be verified). 2. The following Microsoft blog post is interesting background on where MS are going with this: https://devblogs.microsoft.com/command

Re: [fpc-pascal] Read lines into UnicodeString variable from UCS2 (UTF-16) encoded text file

2019-09-04 Thread Tony Whyman
You may be able to improve on this using system.BlockRead. Also, you are assuming low order byte first which may not be portable. On 04/09/2019 11:14, LacaK wrote: Nice! Thank you very much. As an alternative for F:TextFile I am using: procedure UCS2ReadLn(var F: TextFile; out s: String); var

Re: [fpc-pascal] MD5 Hash of StringList

2019-07-05 Thread Tony Whyman
Be careful, the code below is codepage dependent. TStrings.GetTextStr does not inspect the codepage of each string and simply moves the characters into a common buffer. Fast, but the question is: are you using the hash to compare two string lists that are binary equivalent or two string lists t

Re: [fpc-pascal] [OT] Mantis offline

2019-05-10 Thread Tony Whyman
Seems to be online in the UK. On 10/05/2019 15:33, silvioprog wrote: Hello. Could anyone check if Mantis is online? I've tried to access http://bugs.freepascal.org  now (Fri 10 May 2019 11:30:37 AM BRT), but got "This site can’t be reached". Some hours ago it was

Re: [fpc-pascal] how to make a type private to the unit but not defining it in the implementation section?

2019-03-08 Thread Tony Whyman
I would use an "interface" type in this situation. In the unit's "interface" section define the interface type and a function to create a new instance of the interface. In the unit's implementation define all your classes including a class that provides the interface. The implementation of th

[fpc-pascal] Weird FPC String Manager Bug

2018-03-09 Thread Tony Whyman
There seems to be some sort of weird race condition with the FPC string/memory manager. It is not easy to replicate, but the program Gabor Boros posted earlier today to the Lazarus list does seem to find the problem consistently. The program he posted is a simple example of using MWA's Firebir

Re: [fpc-pascal] -CR Command line switch and Firebird.pas

2018-03-04 Thread Tony Whyman
Many thanks - not the most obvious of switch names - but it works. On 04/03/18 14:41, Jonas Maebe wrote: On 04/03/18 15:38, Tony Whyman wrote: Is there anyway of turning off the command line switch -CR (Verify object method call validity) on a per unit basis in the same way that -Cr (range

[fpc-pascal] -CR Command line switch and Firebird.pas

2018-03-04 Thread Tony Whyman
sable with any program that uses the Firebird 3 API. Tony Whyman MWA ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Comp type

2018-01-10 Thread Tony Whyman
seems odd that milliseconds is represented by a "real" type. Tony Whyman On 10/01/18 08:04, Jonas Maebe wrote: Mattias Gaertner wrote: Comp is Int64 div 1. No, that is currency. Comp is a plain 64 bit integer. It originally comes from Turbo Pascal, which did not have a regular 64 b

Re: [fpc-pascal] Possible Memory Leak in TThread.Synchronize

2018-01-03 Thread Tony Whyman
Thanks, I found the problem - the thread was not being destroyed correctly on completion and this manifested itself in what looked like a weird memory leak. On 03/01/18 11:49, Michael Van Canneyt wrote: On Wed, 3 Jan 2018, Tony Whyman wrote: The line "Dispose(tmpentry);" als

[fpc-pascal] Possible Memory Leak in TThread.Synchronize

2018-01-03 Thread Tony Whyman
here is no RtlEventDestroy. Am I correct in pointing the finger here for the memory leak? Tony Whyman MWA ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Database apps on Debian etc.

2017-11-12 Thread Tony Whyman
There are actually two issues sitting here: 1. Transaction Recovery and 2. Knowing when you've lost a connection and when to restart it. I am not familiar with PostgreSQL but with a transaction oriented database such as Firebird or Oracle, when you lose a connection, re-connecting doesn't als

Re: [fpc-pascal] Problem with array of const

2017-10-29 Thread Tony Whyman
I've fallen into various traps with array of const before. I would always recommend that: 1. Test the vType before accessing the argument value and raise an exception if it is not what is expected. You are dealing with a free union and the compiler may not always do what you expect it to. 2.

Re: [fpc-pascal] CRT unit and Windows' terminal

2017-10-14 Thread Tony Whyman
It may be worth looking at the SetTextCodePage in the System unit. On Windows targets I often find it necessary to include SetTextCodePage(output,cp_utf8); to avoid problems writing UTF-8 to the console. On 14/10/17 08:12, pasc...@piments.com wrote: On 13/10/17 14:39, James Richters wrote: I

Re: [fpc-pascal] {$DEFINE DEVEL}

2017-10-11 Thread Tony Whyman
Try adding a space between the { and $ e.g. { $DEFINE DEVEL} FPC then ignores the define On 11/10/17 10:00, pasc...@piments.com wrote: Hi , I had a little trick that I used on BP and Delphi code that does not work on Lazarus. I define compiler variable which I could toggle on and off by a

Re: [fpc-pascal] alternative name fpc cross

2017-10-10 Thread Tony Whyman
On 10/10/17 13:50, pasc...@piments.com wrote: On 10/10/17 13:29, Karoly Balogh (Charlie/SGR) wrote:   Linux Subsystem for Windows. While I know what you mean ... I used to be maintainer on Wine AppDB for several years. Nothing ever worked from one release to the next.  WINE spent 10y  as an

Re: [fpc-pascal] getting cross with the cross compiler

2017-10-10 Thread Tony Whyman
On 10/10/17 05:51, pasc...@piments.com wrote: $make all NOGDB=1 OS_TARGET=linux CPU_TARGET=x86_64 INSTALL_PREFIX=/usr Makefile:2914: *** The only supported starting compiler version is 3.0.0. You are trying to build with 3.1.1..  Stop. BTW is  that msg  is correct? I just built with 3.

Re: [fpc-pascal] getting cross with the cross compiler

2017-10-10 Thread Tony Whyman
On 10/10/17 05:51, pasc...@piments.com wrote: Were it not for the version restrictions in building fpc one could arguably say this was a reasonable assumption.  As it is, it leads to a very confused and confusing state which has taken several days to understand and untangle. Maybe that could

[fpc-pascal] Yet another thread on Unicode Strings

2017-10-04 Thread Tony Whyman
tring should be seen as subsets or special cases of the proposed UniString, and with concrete types such as AnsiChar, WideChar and WideString, other than for legacy reasons, existing primarily to define external interfaces. Tony Whyman MWA Sof

Re: [fpc-pascal] Where and Why is there a memory leak?

2017-09-06 Thread Tony Whyman
Is history repeating itself: http://lists.freepascal.org/pipermail/fpc-pascal/2016-August/048579.html On 06/09/17 09:31, Graeme Geldenhuys wrote: Hi, Playing with this small sample application to answer another question in this mailing list, I noticed the sample application has a memory lea

[fpc-pascal] Proposed tidy-up of the FPC Manual section on Character Types and the FPC Wiki

2017-08-18 Thread Tony Whyman
There has been some heated discussion on the Lazarus lists on the subject to character encodings etc. This has exposed several issues with the FPC Manual that I wanted to record. 1. The char type The manual says: "A Char is exactly 1 byte in size, and contains one ASCII character. " This wa

[fpc-pascal] FPC FIXES__3_0 fails to compile

2017-05-17 Thread Tony Whyman
When compiling the latest fixes branch under Linux 64-bit fpc 3.0.2, with the following make command: make all OS_TARGET=linux CPU_TARGET=x86_64 NOGDB=1 OPT=-O3 NEWOPT=-O4 The compilation failed with: /bin/mkdir -p x86_64/units/x86_64-linux make ./msg2inc make[6]: Entering directory `/home/to

Re: [fpc-pascal] Out of scope method?

2017-04-06 Thread Tony Whyman
Ryan, If you want an example of a complete API implemented using reference counted interfaces than you could do worse than look at my Firebird Pascal API (See https://www.mwasoftware.co.uk/fb-pascal-api). It's fully documented and works with both FPC and Delphi. Tony Whyman MWA On

Re: [fpc-pascal] Out of scope method?

2017-04-06 Thread Tony Whyman
See http://freepascal.org/docs-html/current/ref/refse48.html#x101-1230007.7 for an example. See also http://wiki.freepascal.org/How_To_Use_Interfaces On 06/04/17 10:08, Ryan Joseph wrote: On Apr 6, 2017, at 3:45 PM, Tony Whyman wrote: Isn't this what a COM Interface does - or at le

Re: [fpc-pascal] Out of scope method?

2017-04-06 Thread Tony Whyman
Isn't this what a COM Interface does - or at least a descendent of TInterfacedObject? Tony Whyman MWA On 06/04/17 09:00, Ryan Joseph wrote: Does it exist now or has it ever been discussed that a method in TObject could be called when an instance of an object goes out of scope? It’s c

Re: [fpc-pascal] Threading vs Parallelism ?

2017-03-31 Thread Tony Whyman
On 31/03/17 09:55, Gary Doades wrote: However, multiple independent compute units must be required for*true* parallelism. On a single processor any tasks running at the same time is just an illusion, normally created by the OS in time slicing between tasks based on certain criteria (priority

Re: [fpc-pascal] Threading vs Parallelism ?

2017-03-31 Thread Tony Whyman
The problem I have with this thread (no pun intended) is that it is not comparing like with like. As demonstrated by many of the replies, Parallelism and Threads are not the same thing. I would offer the following definitions: - Parallelism is a (design) concept for expressing collateral actio

Re: [fpc-pascal] https how does it work

2017-03-13 Thread Tony Whyman
h the site copyright being 1993 - 2008 it does look rather moribund. On 13/03/17 07:20, Bo Berglund wrote: On Thu, 16 Feb 2017 14:18:28 +0000, Tony Whyman wrote: The downside is that the indy components do not seem to have been updated for a long time and have not kept up-to-date with OpenS

Re: [fpc-pascal] https how does it work

2017-02-16 Thread Tony Whyman
You can always use the indy components. They have a working https implementation which I have successfully used in a SOAP based application and Lazarus's WST package. (see http://wiki.lazarus.freepascal.org/Indy_with_Lazarus). The downside is that the indy components do not seem to have been

Re: [fpc-pascal] Readln a password

2017-01-03 Thread Tony Whyman
On 27/11/16 17:07, Michael Van Canneyt wrote: If you mean in a cross-platform way, I think we would welcome patches :) Michael. Today, I also came up against the problem of how to read a password from the console without echo. With a bit of googling and code bashing, I have created the follo

[fpc-pascal] Error: Internal error 2014052302

2016-11-20 Thread Tony Whyman
Any ideas as to what this means? Seen on FPC 3.0.0 under AMD64 Linux Mint 17 The odd thing about this one is that : a) Always on the same blank line just after a constructor b) Goes away when you recompile clean c) Seems to be fixed by just moving the constructor to the end of the unit.

Re: [fpc-pascal] Interface performance

2016-11-11 Thread Tony Whyman
similarly, except that a different VMT is used i.e. that which defines the interface. If you try and assign one to the other by just coercing the type then you will get undefined results. On 11/11/16 11:25, Ryan Joseph wrote: On Nov 11, 2016, at 5:52 PM, Tony Whyman wrote: Someone else may

Re: [fpc-pascal] Interface performance

2016-11-11 Thread Tony Whyman
On 11/11/16 10:59, Ryan Joseph wrote: What does memory management even mean for interfaces? I never allocate an interface I just implement it in a class so what’s there to be freed? All these crashes I’m getting suggest memory is being trashed by the compiler at some point without my knowledge

Re: [fpc-pascal] Interface performance

2016-11-11 Thread Tony Whyman
On 11/11/16 10:08, Ryan Joseph wrote: I’m trying your code example now and I get "Class or COM interface type expected, but got “IMyInterface”” when I try to cast with “as”. I was using {$interfaces corba} so maybe that’s the problem? Ooops, as you may guess, I typically work with COM interfac

Re: [fpc-pascal] Interface performance

2016-11-11 Thread Tony Whyman
On 11/11/16 10:25, Ryan Joseph wrote: On Nov 11, 2016, at 4:56 PM, Tony Whyman wrote: 3. To get an object back from an interface you must use the "as" operator. Another point to do with CORBA. The manual says they are not reference counted and programmer needs to do book keeping. T

Re: [fpc-pascal] Interface performance

2016-11-11 Thread Tony Whyman
On 11/11/16 09:46, Ryan Joseph wrote: I just don’t plain get it. The examples given seem to be a redundant property that could be replaced with a reference the interface itself. Interface delegation is really just an optimisation and is equivalent to defining a set of methods to support the int

Re: [fpc-pascal] Interface performance

2016-11-11 Thread Tony Whyman
On 11/11/16 09:46, Ryan Joseph wrote: Just as I got this message I’m running into some inexplicable memory related crashes casting from interfaces to objects and calling methods. Are you sure you can just cast these around like that? The compiler seems to get confused and lose track of what t

Re: [fpc-pascal] Interface performance

2016-11-11 Thread Tony Whyman
t the "supports" function. In use, once you have a variable containing a reference to an interface, it behaves, for the most part, the same as a reference to an object supporting the same methods and properties and should be used as such. Tony Whyman MWA On 11/11/16 08:25, Ryan Josep

Re: [fpc-pascal] Implicit conversion problem with TDate type

2016-11-02 Thread Tony Whyman
On 02/11/16 11:29, Jonas Maebe wrote: On 02/11/16 12:09, Tony Whyman wrote: It's an interesting concept i.e. if a bug exists in Delphi then it must also exist in FPC. Perhaps a better alternative is to fix these sort of bugs in FPC and to introduce a "full Dephi compatibility mode&

Re: [fpc-pascal] Implicit conversion problem with TDate type

2016-11-02 Thread Tony Whyman
It's an interesting concept i.e. if a bug exists in Delphi then it must also exist in FPC. Perhaps a better alternative is to fix these sort of bugs in FPC and to introduce a "full Dephi compatibility mode" i.e. mode Delphi plus the bugs. On 02/11/16 11:04, Gabor Boros wrote: 2016. 11. 02.

Re: [fpc-pascal] inherited interfaces not seen by queryinterface / supports

2016-10-27 Thread Tony Whyman
MyObject1,i2) public procedure Do2; end; That is you can build an object hierarchy to parallel an interface hierarchy. I don't use the "Supports" primitive. - so maybe there is a bug in this feature but otherwise, what is the problem with inter

Re: [fpc-pascal] what is the possible cause of EPrivilege Privileged instruction ?

2016-10-26 Thread Tony Whyman
A couple of ideas (no more than this) 1. A corrupt stack has resulted in a function return address being corrupted and the program jumps to an illegal instruction. 2. Executing data (shouldn't really happen). 3. Corrupt VMT sgain resulting in the program jumping to an illegal instruction.

Re: [fpc-pascal] The Next Release

2016-10-13 Thread Tony Whyman
Of course, fpc might skip version 4 altogether. There is precedent. Winamp skipped version 4 with some lame excuse about not wanting to market "Winamp 4" skins ;-) On 13/10/16 10:56, Graeme Geldenhuys wrote: On 2016-10-13 09:58, Bart wrote: The danger in that is that he might get so excited

[fpc-pascal] The Next Release

2016-10-11 Thread Tony Whyman
What's the timetable for the next release? Can we assume that all of "trunk" will be in it or will it be more nuanced? Tony Whyman MWA ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/m

Re: [fpc-pascal] A serious Memleak using delegates/implements (was: Delegate Interface class does not seem to be referenced counted)

2016-10-07 Thread Tony Whyman
On 07/10/16 12:29, stdreamer wrote: No! Delegation is a mechanism, when used, you have to know exactly how it works. Delegation is only used to minimize code instead of writing a bunch of procedures that call the contained object's methods. That's it and nothing more. I believe that I now und

Re: [fpc-pascal] A serious Memleak using delegates/implements (was: Delegate Interface class does not seem to be referenced counted)

2016-10-07 Thread Tony Whyman
On 07/10/16 12:29, stdreamer wrote: The point is that you are trying to equate delegation with contained objects/interfaces and that is not what delegates are about. Delegation has nothing to do with the underlined mechanism you choose to use. Hmm, not so sure about that. I have updated my o

Re: [fpc-pascal] A serious Memleak using delegates/implements (was: Delegate Interface class does not seem to be referenced counted)

2016-10-07 Thread Tony Whyman
On 07/10/16 11:08, stdreamer wrote: I see no rabbit hole or any other problem in the code posted so far except perhaps lack of proper clean up which might be intentional. A Rabbit Hole is not the same as a bug and my point is not that "interface delegation" does not work, it is that it is count

Re: [fpc-pascal] A serious Memleak using delegates/implements (was: Delegate Interface class does not seem to be referenced counted)

2016-10-07 Thread Tony Whyman
useful to have it documented and, if so, for interface delegation using a TInterfacedObject subclass to be at least deprecated and may be even barred. The problem is that this is Rabbit Hole and it needs filling in otherwise more will fall down it. On 07/10/16 10:31, stdreamer wrote: On 05/10/

Re: [fpc-pascal] fcl-db + IPv6 + Firebird

2016-10-07 Thread Tony Whyman
ith fallback to IPv4. That is the server will normally listen on an IPv6 socket but accept IPv4 incoming. The client initiated connection uses IPv6 or IPv4 depending on the database path name. The release notes have more info. Tony Whyman MWA ___ fpc-pas

Re: [fpc-pascal] A serious Memleak using delegates/implements (was: Delegate Interface class does not seem to be referenced counted)

2016-10-06 Thread Tony Whyman
On 06/10/16 11:08, Graeme Geldenhuys wrote: I've seem some COM Interface code where they had to resort to using raw Pointer types etc to try and avoid reference counting and causing unexpected memory leaks. I have also seen plenty of examples of poor coding with classes, but the fact that someon

Re: [fpc-pascal] A serious Memleak using delegates/implements (was: Delegate Interface class does not seem to be referenced counted)

2016-10-05 Thread Tony Whyman
On 05/10/16 23:03, Graeme Geldenhuys wrote: Martin Schreiber recently mentioned in another Interface discussion that there is a very good reason he doesn’t use COM style interfaces… Reference Counting! Used properly reference counted interfaces are very powerful and allow for some very elegant p

Re: [fpc-pascal] A serious Memleak using delegates/implements (was: Delegate Interface class does not seem to be referenced counted)

2016-10-05 Thread Tony Whyman
On 05/10/16 19:19, Marcos Douglas wrote: Hi Tony, On Wed, Oct 5, 2016 at 1:13 PM, Tony Whyman wrote: [...] 7. You are responsible for freeing the object that "provides" the delegated interface. But I'm working only using Interfaces. All variables are interfaces type. So, I

Re: [fpc-pascal] A serious Memleak using delegates/implements (was: Delegate Interface class does not seem to be referenced counted)

2016-10-05 Thread Tony Whyman
On 05/10/16 16:26, Marcos Douglas wrote: Tony Whyman had posted on August 10 a problem with the compiler using Delegates. He used a workaround to "solve" his problem and the thread died. Marcos, I believe I concluded that this could be a bug or feature. Either way it is a Bear Tr

Re: [fpc-pascal] Free Delphi 10.1 Berlin Starter Edition

2016-08-24 Thread Tony Whyman
On 23/08/16 20:19, geneb wrote: EULAs have the same value as toilet paper and should be used for the same purpose. I for one, will use Delphi for whatever I like, and if Embarcadero has a problem with that, they're invited to kiss my ass. :) In which case I would suggest that you never releas

Re: [fpc-pascal] Delegate Interface class does not seem to be referenced counted

2016-08-18 Thread Tony Whyman
On 18/08/16 10:53, Graeme Geldenhuys wrote: I think you are getting confused between TObject and TInterfaceObject instances, and what is required from both. No, the problem is that I could not find a way of achieving what I wanted to achieve. That is ensuring that an interfaced object that used

Re: [fpc-pascal] Delegate Interface class does not seem to be referenced counted [Solved]

2016-08-17 Thread Tony Whyman
me some time to get my head around it. The worst thing is that I took the example from the FPC Documentation. The FPC documentation on reference counting does not mention how it interacts with delegated interfaces. It probably should. Tony Whyman MWA On 10/08/16 13:42, Tony Whyman wrote: I&#

Re: [fpc-pascal] Delegate Interface class does not seem to be referenced counted

2016-08-10 Thread Tony Whyman
Graeme, You are explicitly freeing MyClass. My point is that with reference counted interfaces and in the example I posted, you shouldn't have to explicitly free the delegated interface. It should be freed automatically as soon as it goes out of scope. Tony Whyman MWA On 10/08/16

Re: [fpc-pascal] Delegate Interface class does not seem to be referenced counted

2016-08-10 Thread Tony Whyman
On 10/08/16 15:05, Marco van de Voort wrote: The way how Tony passes owner is wrong and that messes up reference counting. If in the test he would do TMyclass.Create(Tsomeclass.create); it probably would be ok. But in my test, the code reads: Intf := TMyClass.Create(TDelegateClass.Create)

Re: [fpc-pascal] Delegate Interface class does not seem to be referenced counted

2016-08-10 Thread Tony Whyman
On 10/08/16 13:57, Marcos Douglas wrote: Hi, See the "problem" bellow: TMyClass = class(TInterfacedObject, IMyInterface) private FMyInterface: TDelegateClass; <<< HERE >>> property MyInterface: TDelegateClass read FMyInterface implements IMyInterface; public co

Re: [fpc-pascal] Delegate Interface class does not seem to be referenced counted

2016-08-10 Thread Tony Whyman
Marcos, Thanks for the suggestions, but I had already tried the first variation: TMyClass = class(TInterfacedObject, IMyInterface) private FMyInterface: IMyInterface; // class type property MyInterface: IMyInterface read FMyInterface implements IMyInterface; public

[fpc-pascal] Delegate Interface class does not seem to be referenced counted

2016-08-10 Thread Tony Whyman
while TDelegateClass is being destroyed when it goes out of scope, TMyClass is not. Tony Whyman MWA program project1; {$mode objfpc}{$H+} uses {$IFDEF UNIX}{$IFDEF UseCThreads} cthreads, {$ENDIF}{$ENDIF} Classes, SysUtils, CustApp { you can add units after this }; type { TDelegat

Re: [fpc-pascal] old school crc32

2016-07-24 Thread Tony Whyman
ball in the aviation sector). Regards Tony Whyman MWA ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Resource strings, passwords etc.

2016-07-13 Thread Tony Whyman
What's interested me is how this thread has almost looped back to a recent thread on that steaming heap of brown stuff know as GTK and the attitude of the programmers behind it. I had a similar problem a few years ago whiich I wanted to solve by putting the passwords in an external file and us

Re: [fpc-pascal] PChars and AnsiString Code Pages

2016-05-18 Thread Tony Whyman
mentation says a lot about tyepcasting PChars to AnsiStrings, there seems to be nothing on the reverse. Tony Whyman ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

[fpc-pascal] PChars and AnsiString Code Pages

2016-05-18 Thread Tony Whyman
I've been looking at some old code which still seems to work in fpc 3.0.0 - but is it safe? The code looks like: {$mode delphi} var Buf: PChar; s: string; begin Buf := LoadString; {returns a pointer to an arbitrarily long null terminated string} s := string(Buf); {seems to work - b

Re: [fpc-pascal] RTL and Unicode Strings

2016-05-11 Thread Tony Whyman
On 11/05/16 10:18, Graeme Geldenhuys wrote: In my application I enable unicodestring mode. So I'm reading data from a Firebird database. The data is stored as UTF-8 in a VarChar field. The DB connection is set up as UTF-8. Now lets assume my FreeBSD box is set up with a default encoding of Lati

Re: [fpc-pascal] String theory

2016-05-10 Thread Tony Whyman
I don't think this is what I meant as StringCodePage is a unicode string function. I am looking at the single byte string types. On 10/05/16 14:15, Bart wrote: It already is [part of the string type. See the StringCodePage function. ___ fpc-pascal m

[fpc-pascal] String theory

2016-05-10 Thread Tony Whyman
While my first thought over the "String Type" or "End of World" threads was this is another "how many angels to the pinhead" type discussion. However, having worked through it, I believe that there is an issue here and Pascal could be improved by including (for string types) the code page as pa

[fpc-pascal] Problem using ipc with OSX and fpc 3.0.0

2016-04-20 Thread Tony Whyman
iven under OSX (preferably in a platform independent manner). Tony Whyman MWA ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] A better way?

2016-04-15 Thread Tony Whyman
Just remembered, FPC also supports macros - see http://www.freepascal.org/docs-html/prog/progse5.html I haven't tested it, but you should be able to do {$MACRO On} {$DEFINE aClassBObject:=TClassB(FClassBObject) } and then use aClassBObject instead of the coercion. On 15/04/16 11:13,

Re: [fpc-pascal] A better way?

2016-04-15 Thread Tony Whyman
On 15/04/16 10:00, Ryan Joseph wrote: So, a common scenario is a member variable being declared as TObject then having to typecast it every time I need to access one of it’s methods. Declaring another variable in each function instead of typecasting is perhaps more work but maybe I’m not get

Re: [fpc-pascal] A better way?

2016-04-15 Thread Tony Whyman
entifier is not restricted to function parameters. Regards Tony Whyman MWA On 15/04/16 07:15, Ryan Joseph wrote: I’ve cleaned up some code by declaring uses in the implementation and using generic untyped variables like TObject for parameters. This compiles but I’m left with lots of ugly type

Re: [fpc-pascal] A better way?

2016-04-14 Thread Tony Whyman
Ryan, Maybe I’m doing something stupid but other languages have forward declarations so I wonder why Pascal isn’t doing this also since it seems like the obvious solution. Pascal does have forward declarations e.g. class TClassB; class TClassA private FClassBObject: TClassB; end; class T

Re: [fpc-pascal] A better way?

2016-04-14 Thread Tony Whyman
m the "interface uses" to the "implementation uses", replacing the class reference in the unit interface to something generic like "TObject" and them coercing it to the required class when you actually use it. I hope this helps. Regards Tony Whyman MWA On

[fpc-pascal] Running fpcmake, lazarus and fpc 3.0.0

2016-02-01 Thread Tony Whyman
When building release versions of lazarus programs I use build scripts that build both linux and windows targets on the same system using the fpcross compiler (from linux x64_86 to win32). To do this I obviously need to build both x64_86 and win32 versions of the lazarus libraries on the same l

Re: [fpc-pascal] Issues with fpc-build-3.0.0

2016-01-29 Thread Tony Whyman
I think that my concern is that I fell into a simple trap. Now I know it's there I probably won't do it again - but I want to report it so that others don't do the same thing. The problem is that intuitively "make install" should install a working program or bring an existing one up-to-date. C

Re: [fpc-pascal] Issues with fpc-build-3.0.0

2016-01-29 Thread Tony Whyman
I am not convinced that it is a good idea for the default install to result in a broken system. Wouldn't it be better to have a "NOSYMLINK" environment variable instead to handle the developer versions? Failing that a "README" file giving basic build instructions could be useful or a final mes

Re: [fpc-pascal] Issues with fpc-build-3.0.0

2016-01-29 Thread Tony Whyman
On 29/01/16 13:14, Sven Barth wrote: Am 29.01.2016 13:24 schrieb "Tony Whyman" mailto:tony.why...@mccallumwhyman.com>>: > > I'm experimenting with building fpc from source in various combinations and a couple of issues have come up which could be bugs o

Re: [fpc-pascal] Issues with fpc-build-3.0.0

2016-01-29 Thread Tony Whyman
On 29/01/16 13:17, Michael Van Canneyt wrote: This is as designed. The symlink is only installed with the installsymlink make target in the compiler directory. Why? This means that "make install" is effectively broken as the symlink is essential for the compiler to work. ___

  1   2   >