[fpc-devel] patch for classes.inc: free items of InitHandlerList

2005-04-27 Thread Vincent Snijders
Hi,
Attached patch frees the items of the InitHandlerList. The items are 
allocated in RegisterInitComponentHandler, but never seem to be freeed.
Heaptrc showed a memleak, when you ran lazarus with the cgi package 
installed.

Regards,
Vincent
Index: rtl/objpas/classes/classes.inc
===
RCS file: /FPC/CVS/fpc/rtl/objpas/classes/classes.inc,v
retrieving revision 1.26
diff -u -r1.26 classes.inc
--- rtl/objpas/classes/classes.inc  13 Apr 2005 16:16:43 -  1.26
+++ rtl/objpas/classes/classes.inc  27 Apr 2005 06:44:21 -
@@ -1496,6 +1496,8 @@
   ComponentPages.Free;
   {!!!: GlobalNameSpace.Free;
   GlobalNameSpace := nil;}
+  for i := 0 to InitHandlerList.Count - 1 do
+TInitHandler(InitHandlerList.Items[I]).Free;
   InitHandlerList.Free;
   InitHandlerList:=Nil;
   FindGlobalComponentList.Free;
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


[fpc-devel] is smartlink of Win32 DLLs broken again? And a old FreeBSD port problem additionaly

2005-04-27 Thread Pavel V. Ozerski
Hello all,

1) I tried now to build a dll with {$smartlink on} using 1.9.9 compiler
built at beginning of April. The created DLL did not contain export
names. An analysis of generated asm code pointed that although a
global label at beginning of .rva-containing asm-file has been
correctly created but the PASCALMAIN module did not contain a
reference to this label. At result, all EDATAs sould be eliminated at
linking stage.

2) Because I braced up, to write this letter :), I would also report a
old problem which I got using an old 1.1 FreeBSD port. I needed to
build a shared UDF library for MySQL. While loading created .so file,
I got an error message - something like main entry point not found.
An analysis of asm code demonstated that global main function mas
named not main but had a name combined from a shared module name and
_main, therefore the dynamic linker could not find main entry point.
At that time I solved this problem editing the asm code but this way
seems to be not normal.

Sincerely, Pavel



___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] is smartlink of Win32 DLLs broken again? And a old FreeBSD port problem additionaly

2005-04-27 Thread Peter Vreman
 Hello all,

 1) I tried now to build a dll with {$smartlink on} using 1.9.9 compiler
 built at beginning of April. The created DLL did not contain export
 names. An analysis of generated asm code pointed that although a
 global label at beginning of .rva-containing asm-file has been
 correctly created but the PASCALMAIN module did not contain a
 reference to this label. At result, all EDATAs sould be eliminated at
 linking stage.

Maybe a problem with binutils. The stripping of .stabs sections (ld -s
or using strip) is also broken with recent binutils. We can't use old
binutils since they can't link with recent cygwin libraries.

Since the problem is not in FPC code we can't fix it.




___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] patch for classes.inc: free items of InitHandlerList

2005-04-27 Thread Vincent Snijders
Vincent Snijders wrote:
Hi,
Attached patch frees the items of the InitHandlerList. The items are 
allocated in RegisterInitComponentHandler, but never seem to be freeed.
Heaptrc showed a memleak, when you ran lazarus with the cgi package 
installed.

Further testing showed that the patch contained a bug. InitHandlerList 
might not be created at all. Attached patch corrects also this case.

Sorry for the confusion.
Regards,
Vincent.
Index: rtl/objpas/classes/classes.inc
===
RCS file: /FPC/CVS/fpc/rtl/objpas/classes/classes.inc,v
retrieving revision 1.26
diff -u -r1.26 classes.inc
--- rtl/objpas/classes/classes.inc  13 Apr 2005 16:16:43 -  1.26
+++ rtl/objpas/classes/classes.inc  27 Apr 2005 08:02:25 -
@@ -1496,6 +1496,9 @@
   ComponentPages.Free;
   {!!!: GlobalNameSpace.Free;
   GlobalNameSpace := nil;}
+  if (InitHandlerListNil) then
+for i := 0 to InitHandlerList.Count - 1 do
+  TInitHandler(InitHandlerList.Items[I]).Free;
   InitHandlerList.Free;
   InitHandlerList:=Nil;
   FindGlobalComponentList.Free;
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


[fpc-devel] generics

2005-04-27 Thread Danny Milosavljevic
Hi,

I'm trying to add support for generics (templates) to fpc.

Do we want to have a generics section (like interface,
implementation) or do we want a special source code type (like unit,
program) in the source code ?

I'm tending to a special source code type generic unit.

The generic source code file (.pas,.pp) is installed (not the .ppu,.o).
Then in the 'uses' handler, when not finding a ppu, it reverts to the
pas file, and then finds that it is a special source code generic unit
or so, so it *doesnt* compile it right now, but 'uses' actually just
registers the generic classes as 'available for compilation later'.

When first using a specialization declaration like 'GListInteger',
_then_ it is compiled (after injecting the specialization types to use)
(where to? a special .o file like glist-system-integer.o or
glist-someunit-someclass.o ? use a .ppu too ? I guess so)

I'm leaving advanced features out for now, like any types
(variant-interface to a generic), although it could be argued that the
generic class could compile using the any types (most likely
Variant) later.

Opinions?

cheers,
   Danny

-- 
www.keyserver.net key id A334AEA6



signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] generics

2005-04-27 Thread Peter Vreman
 Hi,

 I'm trying to add support for generics (templates) to fpc.

 Do we want to have a generics section (like interface,
 implementation) or do we want a special source code type (like unit,
 program) in the source code ?

 I'm tending to a special source code type generic unit.

 The generic source code file (.pas,.pp) is installed (not the .ppu,.o).
 Then in the 'uses' handler, when not finding a ppu, it reverts to the
 pas file, and then finds that it is a special source code generic unit
 or so, so it *doesnt* compile it right now, but 'uses' actually just
 registers the generic classes as 'available for compilation later'.

You only need 1 generic type at once. Why should a complete generic unit
be used? Also using it as a unit is inconsistent with the way that units
are handled and will require a lot of if..then parts in the unit loading
code. And that code is already one of the most complex parts of the
compiler. It is already on a after 2.0 todo list to be rewritten because
of this complexity.




___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel