Re: [fpc-pascal] Example for unit paszlib

2021-08-26 Thread Rainer Stratmann via fpc-pascal
Yes it works now. I used the unit paszlib like in the wiki on top and in the url of the wiki. It works somehow, because the paszlib unit exists. But I changed it into zipper now and everything is fine! Thank you for helping me. Am Mittwoch, 25. August 2021, 22:14:26 CEST schrieb Michael Van

Re: [fpc-pascal] Bookmark, TBookmarkStr, TBytes and BytesOf

2021-08-26 Thread Michael Van Canneyt via fpc-pascal
On Thu, 26 Aug 2021, Santi via fpc-pascal wrote: that :/ By the way, BytesOf documentation is also misleading In what sense ? https://www.freepascal.org/docs-html/rtl/sysutils/bytesof.html The abstract is  "Return the bytes in a string". Probably you can blame my English, but I think

Re: [fpc-pascal] Bookmark, TBookmarkStr, TBytes and BytesOf

2021-08-26 Thread Santi via fpc-pascal
El 26/08/2021 a las 13:05, Michael Van Canneyt via fpc-pascal escribió: On Thu, 26 Aug 2021, Santi via fpc-pascal wrote: El 26/08/2021 a las 11:58, Michael Van Canneyt via fpc-pascal escribió: On Thu, 26 Aug 2021, Santiago A. via fpc-pascal wrote: Hello: Freepascal 3.2.0. Windows

Re: [fpc-pascal] Raise exception in libray which will not halt host application

2021-08-26 Thread LacaK via fpc-pascal
Please note that you won't be able to catch such an exception with the type from within the application, e.g.: === code begin === try   SomeLibraryFunction; except   on e: TMyObject do Whatever;   else WhateverElse; end; === code end === The above code would go to the first

Re: [fpc-pascal] Raise exception in libray which will not halt host application

2021-08-26 Thread Sven Barth via fpc-pascal
Am 26.08.2021 um 12:59 schrieb LacaK via fpc-pascal: Am 26.08.2021 um 10:10 schrieb LacaK via fpc-pascal: Thank you for both answers! Please note that you won't be able to catch such an exception with the type from within the application, e.g.: === code begin === try  

Re: [fpc-pascal] Bookmark, TBookmarkStr, TBytes and BytesOf

2021-08-26 Thread Michael Van Canneyt via fpc-pascal
On Thu, 26 Aug 2021, Santi via fpc-pascal wrote: El 26/08/2021 a las 11:58, Michael Van Canneyt via fpc-pascal escribió: On Thu, 26 Aug 2021, Santiago A. via fpc-pascal wrote: Hello: Freepascal 3.2.0. Windows 7-32bits TMyObject=class   private     fDset:TDataset;    function

Re: [fpc-pascal] Raise exception in libray which will not halt host application

2021-08-26 Thread LacaK via fpc-pascal
Am 26.08.2021 um 10:10 schrieb LacaK via fpc-pascal: Thank you for both answers! Please note that you won't be able to catch such an exception with the type from within the application, e.g.: === code begin === try   SomeLibraryFunction; except   on e: TMyObject do Whatever;   else

Re: [fpc-pascal] Bookmark, TBookmarkStr, TBytes and BytesOf

2021-08-26 Thread Santi via fpc-pascal
El 26/08/2021 a las 11:58, Michael Van Canneyt via fpc-pascal escribió: On Thu, 26 Aug 2021, Santiago A. via fpc-pascal wrote: Hello: Freepascal 3.2.0. Windows 7-32bits TMyObject=class   private     fDset:TDataset;    function GetBookmark:TBookmarkStr; ... end; function

Re: [fpc-pascal] Raise exception in libray which will not halt host application

2021-08-26 Thread Sven Barth via fpc-pascal
Am 26.08.2021 um 10:10 schrieb LacaK via fpc-pascal: Thank you for both answers! Please note that you won't be able to catch such an exception with the type from within the application, e.g.: === code begin === try   SomeLibraryFunction; except   on e: TMyObject do Whatever;   else    

Re: [fpc-pascal] Bookmark, TBookmarkStr, TBytes and BytesOf

2021-08-26 Thread Michael Van Canneyt via fpc-pascal
On Thu, 26 Aug 2021, Santi via fpc-pascal wrote: El 26/08/2021 a las 11:58, Michael Van Canneyt via fpc-pascal escribió: On Thu, 26 Aug 2021, Santiago A. via fpc-pascal wrote: Hello: Freepascal 3.2.0. Windows 7-32bits TMyObject=class   private     fDset:TDataset;    function

Re: [fpc-pascal] Bookmark, TBookmarkStr, TBytes and BytesOf

2021-08-26 Thread Santi via fpc-pascal
El 26/08/2021 a las 11:58, Michael Van Canneyt via fpc-pascal escribió: On Thu, 26 Aug 2021, Santiago A. via fpc-pascal wrote: Hello: Freepascal 3.2.0. Windows 7-32bits TMyObject=class   private     fDset:TDataset;    function GetBookmark:TBookmarkStr; ... end; function

Re: [fpc-pascal] Bookmark, TBookmarkStr, TBytes and BytesOf

2021-08-26 Thread Michael Van Canneyt via fpc-pascal
On Thu, 26 Aug 2021, Santiago A. via fpc-pascal wrote: Hello: Freepascal 3.2.0. Windows 7-32bits TMyObject=class   private     fDset:TDataset;    function GetBookmark:TBookmarkStr; ... end; function TMyObject.GetBookmark:TBookmarkStr; Begin   result:=FDset.Bookmark; end; I get this

Re: [fpc-pascal] Bookmark, TBookmarkStr, TBytes and BytesOf

2021-08-26 Thread LacaK via fpc-pascal
I have considered to convert the TBytes to AnsiString, but instead to doing a research about AnsiString internals, or creating a function that copies bytes in a loop, I supposed that there was already a function to do that. I found BytesOf

[fpc-pascal] Bookmark, TBookmarkStr, TBytes and BytesOf

2021-08-26 Thread Santiago A. via fpc-pascal
Hello: Freepascal 3.2.0. Windows 7-32bits TMyObject=class   private     fDset:TDataset;    function GetBookmark:TBookmarkStr; ... end; function TMyObject.GetBookmark:TBookmarkStr; Begin   result:=FDset.Bookmark; end; I get this compiling error: Incompatible types: got "TBytes" expected

Re: [fpc-pascal] function const default argument

2021-08-26 Thread Michael Van Canneyt via fpc-pascal
On Thu, 26 Aug 2021, Santi via fpc-pascal wrote: El 26/08/2021 a las 10:00, Ondrej Pokorny via fpc-pascal escribió: On 26.08.2021 09:40, Santiago A. via fpc-pascal wrote: const  DefaultDelta:extended = 1E-8; function F(const x:extended; const delta:extended=DefaultDelta):extended; function

Re: [fpc-pascal] function const default argument

2021-08-26 Thread Santi via fpc-pascal
El 26/08/2021 a las 10:00, Ondrej Pokorny via fpc-pascal escribió: On 26.08.2021 09:40, Santiago A. via fpc-pascal wrote: const  DefaultDelta:extended = 1E-8; function F(const x:extended; const delta:extended=DefaultDelta):extended; function G(const x:extended; const

Re: [fpc-pascal] Raise exception in libray which will not halt host application

2021-08-26 Thread LacaK via fpc-pascal
Thank you for both answers! L. On Thu, 26 Aug 2021, LacaK via fpc-pascal wrote: Hello, is there way how to raise exception in library without using SysUtils? Raise TMyObject.Create() Where TMyObject does not descend from Exception. Sysutils is needed for the definition of the Exception

Re: [fpc-pascal] function const default argument

2021-08-26 Thread Ondrej Pokorny via fpc-pascal
On 26.08.2021 09:40, Santiago A. via fpc-pascal wrote: const  DefaultDelta:extended = 1E-8; function F(const x:extended; const delta:extended=DefaultDelta):extended; function G(const x:extended; const delta:extended=DefaultDelta):extended; But I get "Illegal expression" in the header function

[fpc-pascal] function const default argument

2021-08-26 Thread Santiago A. via fpc-pascal
Hello: Freepascal 3.2.0. Windows 7-32bits I have these functions: function F(const x:extended; const delta:extended=1E-8):extended; function G(const x:extended; const delta:extended=1E-8):extended; and I want to parametrize like this: const  DefaultDelta:extended = 1E-8; function F(const

Re: [fpc-pascal] Raise exception in libray which will not halt host application

2021-08-26 Thread Michael Van Canneyt via fpc-pascal
On Thu, 26 Aug 2021, LacaK via fpc-pascal wrote: Hello, is there way how to raise exception in library without using SysUtils? Raise TMyObject.Create() Where TMyObject does not descend from Exception. Sysutils is needed for the definition of the Exception class, and because it installs

Re: [fpc-pascal] Conditional compilation using {$IFOPT ...} and {$IF OPTION(...)}

2021-08-26 Thread Michael Van Canneyt via fpc-pascal
On Thu, 26 Aug 2021, LacaK via fpc-pascal wrote: Hello, looking at https://www.freepascal.org/docs-html/prog/progsu126.html#x139-142.4.1 There is mentioned "OPTION(opt)" with comment: "evaluates to TRUE if a compiler option is set (mode MacPas only). It is equivalent to the {$IFOPT }

[fpc-pascal] Raise exception in libray which will not halt host application

2021-08-26 Thread LacaK via fpc-pascal
Hello, is there way how to raise exception in library without using SysUtils? Now I call System.RunError() in case unexpected situation occurs in library (DLL), but this exits also application which links library. Is there way how to exit library in a way that application can catch exception