Re: [fpc-pascal] Does SetLength clear its elements to zeros?

2015-12-11 Thread Jonas Maebe
Dennis wrote on Fri, 11 Dec 2015: I just tested, SetLength a string does not zero its elements (the chars). However, SetLength a dynamic array seems to zero its elements. Dynamic arrays are indeed zeroed when changing the length, while strings are not. For dynamic arrays, it is necessary

Re: [fpc-pascal] Does SetLength clear its elements to zeros?

2015-12-11 Thread Mark Morgan Lloyd
Jonas Maebe wrote: Dennis wrote on Fri, 11 Dec 2015: I just tested, SetLength a string does not zero its elements (the chars). However, SetLength a dynamic array seems to zero its elements. Dynamic arrays are indeed zeroed when changing the length, while strings are not. For dynamic

Re: [fpc-pascal] extreme memory growth using cthreads and default heap manager

2015-12-11 Thread Jonas Maebe
Seth Grover wrote on Thu, 10 Dec 2015: I am experiencing a weird issue regarding threading and shared libraries under Linux. I've boiled it down to a very simple test case in hopes you can help me understand what I'm doing wrong. You're not doing anything wrong. It's caused by

Re: [fpc-pascal] Does SetLength clear its elements to zeros?

2015-12-11 Thread Dennis Poon
Jonas Maebe wrote: Dennis wrote on Fri, 11 Dec 2015: I just tested, SetLength a string does not zero its elements (the chars). However, SetLength a dynamic array seems to zero its elements. Dynamic arrays are indeed zeroed when changing the length, while strings are not. For dynamic

Re: [fpc-pascal] extreme memory growth using cthreads and default heap manager

2015-12-11 Thread Seth Grover
Jonas wrote: > > >> I am experiencing a weird issue regarding threading and shared libraries > >> under Linux. I've boiled it down to a very simple test case in hopes you > >> can help me understand what I'm doing wrong. > > >You're not doing anything wrong. It's caused by >

[fpc-pascal] Where is fpc finding link directories?

2015-12-11 Thread Anthony Walter
I am having a problem with fpc picking up linking directories on my Raspberry Pi. I have a this lib: /opt/vc/lib/libGLESv2.so When I execute "ldconfig -v" it shows both "/opt/vc/lib/" as a ld link directory, and the file libGLESv2.so as a linkable library. But when I use this code in a unit:

Re: [fpc-pascal] alternatives for "cwstring" and "cthreads"

2015-12-11 Thread Graeme Geldenhuys
Many thanks Jonas for all that information. It is very useful to know. Maybe the documentation for cwstrings should include a link to fpwidestring unit and vice-verse. I didn't know about the fpwidestring unit. As for the thread manager being very OS-specific. Well FPC being a compiler that as

Re: [fpc-pascal] Where is fpc finding link directories?

2015-12-11 Thread Anthony Walter
Thanks for the explanation. I guess I'll create symlinks in the standard locations (/usr/lib) for these libraries and put that in an install script. Either that or add to fpc.cfg, I'm not sure which is better. Explanation: I'm creating a series of Pi examples for GLES2 and SDL2 along the lines

Re: [fpc-pascal] Where is fpc finding link directories?

2015-12-11 Thread Andrew Haines
On 12/11/2015 09:50 AM, Anthony Walter wrote: I am having a problem with fpc picking up linking directories on my Raspberry Pi. I have a this lib: /opt/vc/lib/libGLESv2.so I get this linker error during compile: /usr/lib/ld: cannot lind -lGLESv2 But when I compile adding -Fl/opt/vc/lib

[fpc-pascal] alternatives for "cwstring" and "cthreads"

2015-12-11 Thread Graeme Geldenhuys
Hi, http://www.freepascal.org/docs-html/rtl/cwstring/ http://www.freepascal.org/docs-html/rtl/cthreads/ Both the "cwstring and "cthreads" units (as per the documentation) says that it links to the C library of unix systems. Does this make your programs more dependent on a specific version of

Re: [fpc-pascal] Where is fpc finding link directories?

2015-12-11 Thread Jonas Maebe
Anthony Walter wrote on Fri, 11 Dec 2015: I am having a problem with fpc picking up linking directories on my Raspberry Pi. It's unrelated to FPC. The same will happen with GCC or Clang. I have a this lib: /opt/vc/lib/libGLESv2.so When I execute "ldconfig -v" it shows both "/opt/vc/lib/"

Re: [fpc-pascal] alternatives for "cwstring" and "cthreads"

2015-12-11 Thread Jonas Maebe
Graeme Geldenhuys wrote on Fri, 11 Dec 2015: Both the "cwstring and "cthreads" units (as per the documentation) says that it links to the C library of unix systems. Does this make your programs more dependent on a specific version of the C library? Or can you run a current unix program (say

Re: [fpc-pascal] extreme memory growth using cthreads and default heap manager

2015-12-11 Thread Graeme Geldenhuys
On 2015-12-10 21:26, Seth Grover wrote: > Why does using the default memory manager seem to leak memory like crazy if > I'm doing heavy threading? I'm setting FreeOnTerminate to true in > conjunction I can confirm similar behaviour under 64-bit FreeBSD 10.1. Compiled without cmem is ends up using

Re: [fpc-pascal] alternatives for "cwstring" and "cthreads"

2015-12-11 Thread Mark Morgan Lloyd
Jonas Maebe wrote: Graeme Geldenhuys wrote on Fri, 11 Dec 2015: Both the "cwstring and "cthreads" units (as per the documentation) says that it links to the C library of unix systems. Does this make your programs more dependent on a specific version of the C library? Or can you run a current

Re: [fpc-pascal] Where is fpc finding link directories?

2015-12-11 Thread Jonas Maebe
On 11/12/15 17:44, Anthony Walter wrote: I guess I'll create symlinks in the standard locations (/usr/lib) for these libraries and put that in an install script. Either that or add to fpc.cfg, I'm not sure which is better. Definitely the latter. Everything under /usr belongs exclusively to the

Re: [fpc-pascal] alternatives for "cwstring" and "cthreads"

2015-12-11 Thread Jonas Maebe
On 11/12/15 17:31, Graeme Geldenhuys wrote: As for the thread manager being very OS-specific. Well FPC being a compiler that as very CPU and OS specific functionality well abstracted... such a thread manager should be just another abstraction layer. ;-) I'm not suggesting the FPC team implement

Re: [fpc-pascal] alternatives for "cwstring" and "cthreads"

2015-12-11 Thread Sven Barth
On 11.12.2015 17:31, Graeme Geldenhuys wrote: Many thanks Jonas for all that information. It is very useful to know. Maybe the documentation for cwstrings should include a link to fpwidestring unit and vice-verse. I didn't know about the fpwidestring unit. As for the thread manager being very

Re: [fpc-pascal] Where is fpc finding link directories?

2015-12-11 Thread Anthony Walter
Jonas, well the thing is on Raspbian the GLESv2 implementation, which works with the Pi GPU, is at /opt/vc/lib by default. It's owned by root and there is no install. The install I was referring to is building and installing of SDL2 from sources. I already have to tell SDL2 build to find the

[fpc-pascal] Does SetLength clear its elements to zeros?

2015-12-11 Thread Dennis
I just tested, SetLength a string does not zero its elements (the chars). However, SetLength a dynamic array seems to zero its elements. I cannot find the official behaviour by googling. Anyone has the official saying? Dennis ___ fpc-pascal

[fpc-pascal] Writing DLLs to by used in Excel VBA code

2015-12-11 Thread luciano de souza
Hello all, I want to use a DLL writen in Pascal to provide functions for a Excel VBA code: The example code of my DLL is: library CE; {$mode objfpc} uses Sysutils; function level(x1, x2: integer): integer; cdecl; export; begin result := x1 + 2*x2; end; exports level name 'level'; end. In

Re: [fpc-pascal] Where is fpc finding link directories?

2015-12-11 Thread Jonas Maebe
On 11/12/15 18:44, Anthony Walter wrote: Jonas, well the thing is on Raspbian the GLESv2 implementation, which works with the Pi GPU, is at /opt/vc/lib by default. It's owned by root and there is no install. The install I was referring to is building and installing of SDL2 from sources. I