[fpc-pascal] parameter list declaration

2017-03-31 Thread Mr Bee via fpc-pascal
Hi all, I'm looking for official reference for function/procedure parameter list declaration in Pascal. I found this:  http://www.freepascal.org/docs-html/ref/refse91.html but I think it's not really clear, especially for newbie. For example, when exactly we need to use/put ; (semicolon)

[fpc-pascal] Setting record values

2017-03-31 Thread Ryan Joseph
I’ve been using a design pattern in my code which I think is probably pretty stupid so I’d like to make sure. Assume I have a type like TPoint below and I want to set the value I’ll doing something like point := PointMake(x, y). How does the compiler handle this? It probably has to allocate

[fpc-pascal] Array clearing

2017-03-31 Thread Ryan Joseph
As far as the compiler is concerned what’s the difference between clearing an array using a for-loop vs. FillChar? It seems like iterating the array would be slower but what does FillChar do exactly and is it faster? The primary concern here is that the memory originally allocated (using

Re: [fpc-pascal] String Constants and Source File Code Page (Cross-platform)

2017-03-31 Thread African Wild Dog
2017-03-31 15:43 GMT-03:00 Jonas Maebe : > > http://wiki.freepascal.org/FPC_Unicode_support#Source_file_codepage > http://wiki.freepascal.org/FPC_Unicode_support#String_constants > > Thank you! Regards ___ fpc-pascal maillist -

Re: [fpc-pascal] Questions About Constructors

2017-03-31 Thread Sven Barth via fpc-pascal
Am 31.03.2017 19:27 schrieb "African Wild Dog" : > > 2017-03-30 4:25 GMT-03:00 Michael Van Canneyt : >> >> >> >> On Thu, 30 Mar 2017, African Wild Dog wrote: >> >>> Hello, >>> >>> 1 - What happens if my constructor raise an exception? Is my

Re: [fpc-pascal] String Constants and Source File Code Page (Cross-platform)

2017-03-31 Thread Jonas Maebe
On 31/03/17 20:01, African Wild Dog wrote: What is the recomended way to deal with string constants in units which are shared in cross-platforms projects? For example, i started a project in Linux, where the source code files are saved in UTF-8. If i use theses files in Windows, the constants

[fpc-pascal] String Constants and Source File Code Page (Cross-platform)

2017-03-31 Thread African Wild Dog
Hello, What is the recomended way to deal with string constants in units which are shared in cross-platforms projects? For example, i started a project in Linux, where the source code files are saved in UTF-8. If i use theses files in Windows, the constants aren't automatically converted to the

Re: [fpc-pascal] Questions About Constructors

2017-03-31 Thread African Wild Dog
2017-03-30 4:25 GMT-03:00 Michael Van Canneyt : > > > On Thu, 30 Mar 2017, African Wild Dog wrote: > > Hello, >> >> 1 - What happens if my constructor raise an exception? Is my destructor >> automatically called? >> > > Yes. > > >> 2 - Are the class fields automatically

Re: [fpc-pascal] Call function in shared library from multiple threads

2017-03-31 Thread silvioprog
On Fri, Mar 31, 2017 at 1:15 PM, Henry Vermaak wrote: > On Fri, Mar 31, 2017 at 08:42:24AM -0700, fredvs wrote: > > > Z:\home\fred\uos\examples\uos.pas(7438,29) Warning: (4046) > Constructing a > > > class "TThread" with abstract method "Execute" > > > > Huh, is it Is it

Re: [fpc-pascal] Call function in shared library from multiple threads

2017-03-31 Thread fredvs
Michael Van Canneyt wrote > Best is probably: > > Type >TDummyThread = Class(TThread) >public > procedure execute; override; >end; > > procedure TDummyThread.Execute; > > begin >FreeOnTerminate:=True; >Terminate; > end; > > > begin >TDummyThread.Create(True) >

Re: [fpc-pascal] Call function in shared library from multiple threads

2017-03-31 Thread Henry Vermaak
On Fri, Mar 31, 2017 at 08:42:24AM -0700, fredvs wrote: > > Z:\home\fred\uos\examples\uos.pas(7438,29) Warning: (4046) Constructing a > > class "TThread" with abstract method "Execute" > > Huh, is it Is it serious doctor? I use this: function DummyThread(param: pointer): ptrint; begin Result

Re: [fpc-pascal] Call function in shared library from multiple threads

2017-03-31 Thread Michael Van Canneyt
On Fri, 31 Mar 2017, fredvs wrote: Hello. Michael Van Canneyt wrote To fix that, you can do the following. In the library startup code, create a dummy thread. This will initialize the threads mechanism: with TThread.Create(False) do end. I use this for initialize my libraries:

Re: [fpc-pascal] Call function in shared library from multiple threads

2017-03-31 Thread fredvs
Hello. Michael Van Canneyt wrote > To fix that, you can do the following. > In the library startup code, create a dummy thread. > This will initialize the threads mechanism: > >with TThread.Create(False) do > > end. I use this for initialize my libraries: With TThread.Create(False) do

Re: [fpc-pascal] Call function in shared library from multiple threads

2017-03-31 Thread Krzysztof
Thanks a lot! Seems to working fine now ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Error on closing application when using a library.

2017-03-31 Thread fredvs
Hello. Once again, fpc has nothing to do with that problem. See here: https://www.kapilarya.com/this-application-has-requested-the-runtime-to-terminate-it-in-an-unusual-way-windows-10 Ok, (grrr...), I will follow this notice. PS: If I may, I find strange that Microsoft cannot make

Re: [fpc-pascal] Call function in shared library from multiple threads

2017-03-31 Thread Michael Van Canneyt
On Thu, 30 Mar 2017, Michael Van Canneyt wrote: On Thu, 30 Mar 2017, Krzysztof wrote: 2017-03-30 15:19 GMT+02:00 Michael Van Canneyt Nevertheless, that should work. I've used it in multi-threaded apache modules. Well it doesn't work or fpjson module is not

Re: [fpc-pascal] Threading vs Parallelism ?

2017-03-31 Thread Ryan Joseph
> On Mar 31, 2017, at 3:55 PM, 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

Re: [fpc-pascal] Threading vs Parallelism ?

2017-03-31 Thread Ryan Joseph
> On Mar 31, 2017, at 4:38 PM, Tony Whyman > wrote: > > For example, this distinction is very important in matrix algorithms. When > operating on two matrices to produce another, the operations on each cell can > be identified as n x m parallel actions at

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

Re: [fpc-pascal] Threading vs Parallelism ?

2017-03-31 Thread Gary Doades
> I would offer the following definitions: > - Parallelism is a (design) concept for expressing collateral actions in > which the processing order of the actions is unspecified. They may take place > serially or > contemporaneously in real time, or a mixture of the two. > - Threads are an

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

Re: [fpc-pascal] SPARC / Linux

2017-03-31 Thread Mark Morgan Lloyd
On 13/03/17 09:00, Pierre Free Pascal wrote: -Message d'origine-> De : fpc-pascal [mailto:fpc-pascal-boun...@lists.freepascal.org] De la> part de Mark Morgan Lloyd> Envoyé : lundi 13 mars 2017 09:11> À : fpc-pascal@lists.freepascal.org> Objet : Re: [fpc-pascal] SPARC / Linux> > On

Re: [fpc-pascal] Threading vs Parallelism ?

2017-03-31 Thread Ryan Joseph
> On Mar 30, 2017, at 3:06 PM, Michael Schnell wrote: > >> >> Huh, ok, but why parallelism is better and how to do it with fpc ? >> > Parallelism within a process always is based on threads. > > AFAIK, fpc does not (yet) provide a more convenient abstraction for >

Re: [fpc-pascal] Threading vs Parallelism ?

2017-03-31 Thread Michael Schnell
On 29.03.2017 20:57, fredvs wrote: Huh, ok, but why parallelism is better and how to do it with fpc ? Parallelism within a process always is based on threads. AFAIK, fpc does not (yet) provide a more convenient abstraction for parallelism (such as parallel loops) than TThread. -Michael