Re: [fpc-pascal] linker apache linux

2009-10-08 Thread Alexey Voytsehovich
Hello ABorka, Thursday, October 8, 2009, 8:41:14 PM, you wrote: > This usually comes when you compiled your Apache module with the wrong > version of httpdXX directory from fpc/packages/. > There are 3 included in fpc: > httpd13 > httpd20 > and > httpd22 > Delete the two that are not your Apach

Re: [fpc-pascal] Re: Support for C++ library format?

2009-10-08 Thread Jorge Aldo G. de F. Junior
One thing that i did not like about FPC Generics is the impossibility of doing something like this : Type generic TList<_T>=class(TObject) type public TCompareFunc = function(const Item1, Item2: _T): Integer; var public data : _T; procedure Add(item: _T); procedure S

Re: [fpc-pascal] Case in Record

2009-10-08 Thread Vinzent Höfler
"Jürgen Hestermann" : > >> And I don't know any other Pascal Compiler who does any checks in > >> this direction. Do some? > > I don't know, but ADA reportedly does. Yes, but the semantics of discriminants is slightly different than in PASCAL. > I don't know the differences to Pascal. Does it ha

Re: [fpc-pascal] linker apache linux

2009-10-08 Thread ABorka
This usually comes when you compiled your Apache module with the wrong version of httpdXX directory from fpc/packages/. There are 3 included in fpc: httpd13 httpd20 and httpd22 Delete the two that are not your Apache version and recompile your module (or in Lazarus -> Project -> Compiler Optio

[fpc-pascal] QueueUserAPC Similar Cross platform Functionality

2009-10-08 Thread Andrew Brunner
Hi there, I've got a unit I'm porting from Windows to Linux and I came across a QueueUserAPC (Kernel32 Windows) I make to add a callback method that gets executed by the thread I added this to. function QueueUserAPC(Callback: Pointer; hThread: THandle; dwData:DWORD): boolean; stdcall; When the T

Re: [fpc-pascal] Case in Record

2009-10-08 Thread Jürgen Hestermann
And I don't know any other Pascal Compiler who does any checks in this direction. Do some? I don't know, but ADA reportedly does. I don't know the differences to Pascal. Does it have the same syntax for variant records? Such a feature definitely seems useful to me. Of course it would b

Re: [fpc-pascal] Case in Record

2009-10-08 Thread Jürgen Hestermann
Given that the OP was asking about learning, maybe it would be worth mentioning that the way we normally have "data structures which hold different data" these days is by polymorphism in objects or classes. Instead of having an array of variant records, each of which might hold a description of

Re: [fpc-pascal] How to free this memory and avoid memory leak

2009-10-08 Thread Graeme Geldenhuys
2009/10/8 Jonas Maebe : > > Also with understanding how dynamic arrays and/or move work. Dynamic arrays > are reference counted pointers to data blobs. sizeof(dynamic_array_var) = > sizeof(pointer), always, and regardless of the length of the array. It's > like sizeof(class) = sizeof(ansistring) =

Re: [fpc-pascal] How to free this memory and avoid memory leak

2009-10-08 Thread Graeme Geldenhuys
2009/10/8 Vincent Snijders : > > Working with pointers, if you don't get it, maybe just use a loop. I have to admit. After working for so long with RDBMS API's, I got quite rusty with the more low level file reading, record structures and pointer arithmetic. Database desktop applications clearly

Re: [fpc-pascal] How to free this memory and avoid memory leak

2009-10-08 Thread Jonas Maebe
On 08 Oct 2009, at 16:18, Graeme Geldenhuys wrote: 2009/10/8 Jonas Maebe : SetLength(tocarray, _Header.ntoc); p := _Data + _Header.tocoffsetsstart; Move(p, tocarray, SizeOf(tocarray)); This has to be move(p^, tocarray^, length(tocarray)*sizeof(tocarray[0]));

Re: [fpc-pascal] How to free this memory and avoid memory leak

2009-10-08 Thread Mattias Gärtner
Zitat von Graeme Geldenhuys : [...] * ntoc = number of entries in the array. Each entry is a LongWord (or Int32 in the code below) * tocarray is my local array that gets populated with information from the file, using the Move() procedure. * tocoffsetsstart is the starting offset of the TOC arr

Re: [fpc-pascal] How to free this memory and avoid memory leak

2009-10-08 Thread Vincent Snijders
Graeme Geldenhuys schreef: 2009/10/8 Jonas Maebe : SetLength(tocarray, _Header.ntoc); p := _Data + _Header.tocoffsetsstart; Move(p, tocarray, SizeOf(tocarray)); This has to be move(p^, tocarray^, length(tocarray)*sizeof(tocarray[0])); ^ This gives a compile

Re: [fpc-pascal] How to free this memory and avoid memory leak

2009-10-08 Thread Graeme Geldenhuys
2009/10/8 Jonas Maebe : > Also, as you can see the program does not really depend on the data being > actually stored in a dynamic array. So you could just as well use "tocarray: > ^Int32" and assign it the value of p (as you pretty much did until now). Ah! That is what I wanted to do in the first

Re: [fpc-pascal] How to free this memory and avoid memory leak

2009-10-08 Thread Andrew Brunner
> >      Move(p, tocarray[0], SizeOf(tocarray)); > This causes an Access Violation at runtime. > This should not cause as RAV. You must call SetLength(toarray,SizeOfMemory) and also don't use SizeOf(tocarray) use Length(tocarray)*SizeOf(What ever the element is)) _

Re: [fpc-pascal] How to free this memory and avoid memory leak

2009-10-08 Thread Graeme Geldenhuys
2009/10/8 Jonas Maebe : >>  SetLength(tocarray, _Header.ntoc); >>  p := _Data + _Header.tocoffsetsstart; >>  Move(p, tocarray, SizeOf(tocarray)); > > This has to be > > move(p^, tocarray^, length(tocarray)*sizeof(tocarray[0])); ^ This gives a compiler error. Illegal

Re: [fpc-pascal] How to free this memory and avoid memory leak

2009-10-08 Thread Jonas Maebe
On 08 Oct 2009, at 15:58, Alexey Voytsehovich wrote: Thursday, October 8, 2009, 4:51:34 PM, you wrote: // Finalize(tocarray);<--- doesn't work Finalize(tocarray, _header.ntoc); <--- doesn't work tocarray := nil; <--- doesn't wor

Re: [fpc-pascal] How to free this memory and avoid memory leak

2009-10-08 Thread Vincent Snijders
Graeme Geldenhuys schreef: Hi, -- procedure THelpFile.ReadContents; var Topic: TTopic; EntryIndex: longint; pEntry: pTTOCEntryStart; tocarray: array of Int32; p: PByte; begin _Topics.Capacity := _Header.ntoc; SetLength(tocarray, _Header.ntoc);

Re: [fpc-pascal] How to free this memory and avoid memory leak

2009-10-08 Thread Alexey Voytsehovich
Hello Graeme, Thursday, October 8, 2009, 4:51:34 PM, you wrote: > tocarray: array of Int32; > p: PByte; > begin > _Topics.Capacity := _Header.ntoc; > SetLength(tocarray, _Header.ntoc); > // Finalize(tocarray);<--- doesn't work > Finalize(tocarray, _header.ntoc);

Re: [fpc-pascal] How to free this memory and avoid memory leak

2009-10-08 Thread Jonas Maebe
On 08 Oct 2009, at 15:51, Graeme Geldenhuys wrote: procedure THelpFile.ReadContents; var Topic: TTopic; EntryIndex: longint; pEntry: pTTOCEntryStart; tocarray: array of Int32; p: PByte; begin _Topics.Capacity := _Header.ntoc; SetLength(tocarray, _Header.ntoc); p := _Data + _Header.toco

[fpc-pascal] How to free this memory and avoid memory leak

2009-10-08 Thread Graeme Geldenhuys
Hi, I enabled heaptrc and it reported on block of memory not being freed. I tracked it down to the following method in my code. I have tried everything I can think of, but the memory leak still persists. Could anybody help me please. A quick description of what this code does. I'm reading content

Re: [fpc-pascal] freepascal and apache

2009-10-08 Thread Alexey Voychehovich
hi again build line on ubuntu fpc -dFPCAPACHE_2_2 mod_hello.pp and got this error on load module in apache -- apache2: Syntax error on line 284 of /etc/apache2/apache2.conf: API module structure 'test_module' in file /etc/apache2/modules/mod_hello.dll is garbled - expected signature 41503232 but sa

Re: [fpc-pascal] Case in Record

2009-10-08 Thread Frank Peelo
On 07/10/2009 16:39, Jürgen Hestermann wrote: IIRC, there is a difference. With the second declaration the compiler can add a run-time check that the correct memebrs are accessed based on the value of X. Unfortunately, I cannot find the compiler switch. FPC has no support for this. And I d

Re: [fpc-pascal] linker apache linux

2009-10-08 Thread Alexey Voytsehovich
Hello Jonas, Thursday, October 8, 2009, 1:54:20 PM, you wrote: >> help again please? > Try ld 2.18.50 > And also use FPC 2.2.4, not 2.2.2. ok on fpc 2.2.4 and binutil 2.9.91 sources cimpiled and linked but if i load module in apache (on ubuntu) i get this error -- can`t locate API module struc

Re: [fpc-pascal] Object instance is suddenly corrupt or of unknown type?

2009-10-08 Thread JoshyFun
Hello FPC-Pascal, Thursday, October 8, 2009, 12:38:20 PM, you wrote: GG> Most of the times te watch output is:FLayout:TRichTextLayout 0xabcedef GG> This is correct. The type is known and the memory address seems fine. GG> (ignore my fake mem address above). GG> But then at some point t

Re: [fpc-pascal] linker apache linux

2009-10-08 Thread Jonas Maebe
On 08 Oct 2009, at 12:36, Alexey Voychehovich wrote: but got this error a...@ubuntu:~$ fpc mod_hello.pp Free Pascal Compiler version 2.2.2-8 [2009/01/08] for i386 Copyright (c) 1993-2008 by Florian Klaempfl Target OS: Linux for i386 Compiling mod_hello.pp Linking libmod_hello.so mod_hello.pp(22

[fpc-pascal] Re: Object instance is suddenly corrupt or of unknown type?

2009-10-08 Thread Graeme Geldenhuys
2009/10/8 Graeme Geldenhuys : > > Anyway what is the correct way of passing a class instance (object) to > methods? Maybe this is my problem? Actually, I don't think this is the issue. There was only two places in my code where I pass the FLayout instance to external procedures. I used to use 'con

[fpc-pascal] Object instance is suddenly corrupt or of unknown type?

2009-10-08 Thread Graeme Geldenhuys
Hi, I'm using FPC 2.3.1 on a 64bit Linux system. I have a field variable which is an class instance. Many methods use this field variable and it's properties. I suddenly started getting Access Violations in my application. Adding that field variable to the Watch Window and stepping through my pro

Re: [fpc-pascal] linker apache linux

2009-10-08 Thread Alexey Voychehovich
i backported to a...@ubuntu:~$ aptitude show binutils Package: binutils State: installed Automatically installed: no Version: 2.18.93.20081009-0ubuntu1 Priority: optional Section: devel Maintainer: Ubuntu Core developers Uncompressed Size: 8729k Depends: libc6 (>= 2.8~20080505), zlib1g (>= 1:1.1.

Re: [fpc-pascal] linker apache linux

2009-10-08 Thread Jonas Maebe
On 08 Oct 2009, at 10:19, Alexey Voytsehovich wrote: Hello Jonas, Thursday, October 8, 2009, 10:49:43 AM, you wrote: Downgrade to binutils 2.18.x, or try upgrading binutils and hope that Ubuntu has backported the required fix already (no new release of binutils has been made since that bug w

Re: [fpc-pascal] linker apache linux

2009-10-08 Thread Alexey Voytsehovich
Hello Jonas, Thursday, October 8, 2009, 10:49:43 AM, you wrote: >> help please. > http://www.freepascal.org/faq.var#unix-ld219 > Downgrade to binutils 2.18.x, or try upgrading binutils and hope that > Ubuntu has backported the required fix already (no new release of > binutils has been made s

Re: [fpc-pascal] Case in Record

2009-10-08 Thread Florian Klaempfl
Jonas Maebe schrieb: > > On 07 Oct 2009, at 17:39, Jürgen Hestermann wrote: > >> And I don't know any other Pascal Compiler who does any checks in this >> direction. Do some? > > I don't know, but ADA reportedly does. Such a feature definitely seems > useful to me. Afaik GPC does as well? _

Re: [fpc-pascal] FIONREAD FPC FpIOCtl for Cross platform Sockets

2009-10-08 Thread Marco van de Voort
In our previous episode, Andrew Brunner said: > Sockets programming often requires a poll for how much data is > available on a particular socket descriptor. > > I'm porting an inhouse library for a sockets implementation and I > realize that while I have a FpIOCtl call in the baseUnix unit I have

Re: [fpc-pascal] linker apache linux

2009-10-08 Thread Jonas Maebe
On 08 Oct 2009, at 08:10, Alexey Voychehovich wrote: Compiling mod_example.pp mod_example.pp(494,3) Note: Local variable "dcfg" is assigned but never used mod_example.pp(1009,3) Note: Local variable "cfg" is assigned but never used Linking ./libmod_example.so mod_example.pp(1342,1) Error:

Re: [fpc-pascal] Case in Record

2009-10-08 Thread Jonas Maebe
On 07 Oct 2009, at 17:39, Jürgen Hestermann wrote: And I don't know any other Pascal Compiler who does any checks in this direction. Do some? I don't know, but ADA reportedly does. Such a feature definitely seems useful to me. Jonas___ fpc-pas

Re: [fpc-pascal] X, Y co-ordinate system under OS/2

2009-10-08 Thread Graeme Geldenhuys
2009/10/7 Tomas Hajny : > > Yes, this is the case as far as I know (I haven't done any GUI programming > under OS/2 myself, but I know that this has always been one of the main > porting obstacles between Win32 and OS/2 at least). I suppose I can see the merits for using each of the co-ordinate sy