Re: [fpc-pascal] Shared libries
On 2011-12-12 00:48, nore...@z505.com wrote: Ok, thanks for clearifying that. I guess it's going to be a lot of include files instead... :) -Torsten. Why do you need include files in your case? You can put the units in the uses clause of your library. Because it is still going to give me a very long list of exports - considering I have approx. 200 methods to export. Instead I would do something like this: library something; {$DEFINE InterfaceSection} {$I unit1} [snip...] {$I unit20} {$UNDEFINE InterfaceSection} exports {$DEFINE ExportSection} {$I unit1}, [snip...] {$I unit20} {$UNDEFINE ExportSection} ; end. unit 1; {$IFDEF InterfaceSection} function Foo(a: integer): integer; begin result := a * a; end; {$ENDIF} {$IFDEF ExportSection} Foo name 'Bar' {$ENDIF} ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Shared libries
On 12 Dec 2011, at 00:48, nore...@z505.com wrote: > In newer versions of FPC it allows you to put an exports clause in the > unit itself, but older versions didn't allow it. > > http://bugs.freepascal.org/bug_view_page.php?bug_id=4398&history=1 That functionality is buggy and cannot be used safely currently: http://bugs.freepascal.org/bug_view_advanced_page.php?bug_id=16070 Jonas___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Shared libries
> Ok, thanks for clearifying that. I guess it's going to be a lot of > include files instead... :) > > -Torsten. Why do you need include files in your case? You can put the units in the uses clause of your library. library something; uses someunit; exports someunit.yourproc; end. The someunit. prefix is optional. In newer versions of FPC it allows you to put an exports clause in the unit itself, but older versions didn't allow it. http://62.166.198.202/bug_view_page.php?bug_id=4398&history=1 In delphi 1.0 the export directive meant something different which causes confusion. Borland made export directive obsolete but kept the export keyword there probably for compiling old code. fpc has slightly different reasons for the export directive than delphi and lots of confusion arises. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Shared libries
On 2011-12-11 23:30, Jonas Maebe wrote: On 11 Dec 2011, at 23:18, Torsten Bonde Christiansen wrote: So in the following example "foo" would not be visible (neither as "foo" nor "bar") to other program (eg. a C-program) unless I added an *exports* section? Correct. See also http://bugs.freepascal.org/bug_view_advanced_page.php?bug_id=18552 Basically what i'm trying to do, is use a lot of units and I want avoid creating a HUGE *exports* section but rather name the methods in the units instead. That is not possible. Whether or not a routine is exported is a property of the library, not of the individual units that are used (directly or indirectly) by the library. Jonas___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal Ok, thanks for clearifying that. I guess it's going to be a lot of include files instead... :) -Torsten. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Shared libries
On 11 Dec 2011, at 23:18, Torsten Bonde Christiansen wrote: > So in the following example "foo" would not be visible (neither as "foo" nor > "bar") to other program (eg. a C-program) unless I added an *exports* section? Correct. See also http://bugs.freepascal.org/bug_view_advanced_page.php?bug_id=18552 > Basically what i'm trying to do, is use a lot of units and I want avoid > creating a HUGE *exports* section but rather name the > methods in the units instead. That is not possible. Whether or not a routine is exported is a property of the library, not of the individual units that are used (directly or indirectly) by the library. Jonas___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Shared libries
On 2011-12-11 22:57, ik wrote: On Sun, Dec 11, 2011 at 23:35, Torsten Bonde Christiansen mailto:t...@epidata.dk>> wrote: Hi. I'm trying to create a shared library (under linux) and I not sure what the difference between the modifier *export* and the section *exports* is? Or perhaps when to use one and the other... export means that you can control the name of a symbol in how it will be in the elf file itself of the so. So you call your original procedure Foo, but you export it as 'baz', so using objdump in Linux, you'll find "baz" and not "Foo". Exports, is the way to tell the compiler what are the symbols you wish to make available for reuse in the so file itself, so I could bind to them. So in the following example "foo" would not be visible (neither as "foo" nor "bar") to other program (eg. a C-program) unless I added an *exports* section? library test; function foo(a: integer): integer; [export, alias: 'bar']; begin result := a * a; end; end. Basically what i'm trying to do, is use a lot of units and I want avoid creating a HUGE *exports* section but rather name the methods in the units instead. Regards, Torsten Bonde Christiansen. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Shared libries
On Sun, Dec 11, 2011 at 23:35, Torsten Bonde Christiansen wrote: > Hi. > > I'm trying to create a shared library (under linux) and I not sure what the > difference between the modifier *export* and the section *exports* is? Or > perhaps > when to use one and the other... > export means that you can control the name of a symbol in how it will be in the elf file itself of the so. So you call your original procedure Foo, but you export it as 'baz', so using objdump in Linux, you'll find "baz" and not "Foo". Exports, is the way to tell the compiler what are the symbols you wish to make available for reuse in the so file itself, so I could bind to them. > > I have read both the programmers guide (7.2) and reference guide (11.9.3) > but this > didn't really help me. > > Kind regards, > Torsten Bonde Christiansen. > > ___ > fpc-pascal maillist - fpc-pascal@lists.freepascal.org > http://lists.freepascal.org/mailman/listinfo/fpc-pascal > ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Shared libries
> Hi. > > I'm trying to create a shared library (under linux) and I not sure what > the > difference between the modifier *export* and the section *exports* is? > Or perhaps > when to use one and the other... Just different ways of doing it. You can export each one, or you can use exports clause to do it all there in one place. I think it is from the old borland days when they used to do the export, but then they added exports as a feature.. but I'm not 100 percent sure. A long time ago when I was using libraries on linux, I had some problems, with initialization and finalization sections, I'm not sure if the problems are fixed. Also on BSD it didn't load libraries back then, not sure if it has changed. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] Shared libries
Hi. I'm trying to create a shared library (under linux) and I not sure what the difference between the modifier *export* and the section *exports* is? Or perhaps when to use one and the other... I have read both the programmers guide (7.2) and reference guide (11.9.3) but this didn't really help me. Kind regards, Torsten Bonde Christiansen. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Sorting an open unidimensional array
Yes, the unit seems to be very complete. I will study it and I am sure good results will come up! Thank you! Em 11/12/2011 18:18, Martin Schreiber escreveu: On 12/11/2011 09:10 PM, Luciano de Souza wrote: Hello listers, I want to sort an open unidimensional array of integers from the minimum to the maximum and from the maximum to the minimum. MSEgui has sorting functions for dynamic arrays in lib/common/kernel/msearrayutils.pas. http://gitorious.org/mseide-msegui/mseide-msegui/blobs/master/lib/common/kernel/msearrayutils.pas Martin ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal -- Luciano de Souza ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Sorting an open unidimensional array
On 12/11/2011 09:10 PM, Luciano de Souza wrote: > Hello listers, > > I want to sort an open unidimensional array of integers from the minimum > to the maximum and from the maximum to the minimum. > MSEgui has sorting functions for dynamic arrays in lib/common/kernel/msearrayutils.pas. http://gitorious.org/mseide-msegui/mseide-msegui/blobs/master/lib/common/kernel/msearrayutils.pas Martin ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] Sorting an open unidimensional array
Hello listers, I want to sort an open unidimensional array of integers from the minimum to the maximum and from the maximum to the minimum. Is there a standard unit providing this kind of service? Regarding the number of elements is not very high, I don't need complex algorithms. Thank you in advance! Luciano -- Luciano de Souza ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] IInterface type value and the "as" keyword
2011/12/11 Marco van de Voort : > In our previous episode, Honza said: >> Now I'm trying to make that code work with >> current stable (AFAICS that's 2.4.4) > > Correct, but it is relatively short before the 2.6.0 release, with a first > RC1 already available. Since 2.6.0 might arrive this year still (or in the > first week of the next), I suggest your focus your attention there, and > forget about 2.4.4. Good suggestion, done exactly that. >> I suppose something has changed with the FPC interfaces and/or using >> the "as" keyword in the above construct. Of course I searched e.g. the >> "changes" wiki pages 2.4.0->2.4.2->2.4.4(and even ->2.6.0), but I >> failed to find anything related, the same result for the mailing lists >> and general googling attempts. And of course I tried every single >> change to the code I could imagine may work. > > I assume it is bugfixed in 2.5+, which never made it back to the 2.4 series. Yes, after switching to 2.6.0 the problem disappeared, thank you very much! Thanks to your help (and some hours of hacking), I'm now here: $ ./helib_test -a -p --format=plain ... Number of run tests: 701 Number of errors:0 Number of failures: 0 Heap dump by heaptrc unit 5844426 memory blocks allocated : 252487390/286727568 5844426 memory blocks freed : 252487390/286727568 0 unfreed memory blocks : 0 True heap size : 294912 True free heap : 294912 $ ;-) Thanks again! Best regards, -bflm PS: helib/heContnrs release-0.4, RC1 for FPC 2.6.0 (tested with svn rev 19814), tar download available here: http://code.google.com/p/fprb/downloads/detail?name=release-0.4.tar.gz Feedback/issue reports/volunteers to test on other platforms/architectures/... welcome. (I can easily run tests only on 64bit Ubuntu 10.10.) ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] "Free Pascal Programmer's Guide" - where is the latest version?
On Sun, 11 Dec 2011, Bernd wrote: Where did you find this in the docs ? On the official ftp server: ftp://ftp.freepascal.org/pub/fpc/beta/2.6.0-rc1/docs/ I downloadad doc-pdf.zip (file dats inside the zip of all contained pdf files is 2011-10-9-18:01) The file I am referring to is the prog.pdf (Programmer's guide): Programmer’s Guide for Free Pascal, Version 2.6.0rc1 Document version 2.4 October 2011 On page 121 in chapter 11.3 Optimization switches: "-Or: This setting causes the code generator to check which variables are used most, so it can keep those in a register." (there are also a few more mentionings in other parts of the document) Ahhh... I was looking in the user's guide, in the explanation of the compiler switches. There everything was OK. I didn't look in the programmer's guide. I will adapt the programmer's guide. Thank you for the clarification ! Michael.___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] CloseThread needed? still unclear
I wrote: > > I think I found some documentation that still doesn't include > CloseThread in the examples.. I will send patches or recommendations to > the documentation soon. For example closethread is now documented as a > function, but some of the other pages that show threading examples just > use endthread. I thought maybe closethread somehow was tied into endthread > but this not the case. > For example: http://www.freepascal.org/docs-html/prog/progse44.html#x217-2310.2 In this example it doesn't call closethread (and it doesn't use endthread). ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] "Free Pascal Programmer's Guide" - where is the latest version?
> Where did you find this in the docs ? On the official ftp server: ftp://ftp.freepascal.org/pub/fpc/beta/2.6.0-rc1/docs/ I downloadad doc-pdf.zip (file dats inside the zip of all contained pdf files is 2011-10-9-18:01) The file I am referring to is the prog.pdf (Programmer's guide): Programmer’s Guide for Free Pascal, Version 2.6.0rc1 Document version 2.4 October 2011 On page 121 in chapter 11.3 Optimization switches: "-Or: This setting causes the code generator to check which variables are used most, so it can keep those in a register." (there are also a few more mentionings in other parts of the document) Bernd ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] "Free Pascal Programmer's Guide" - where is the latest version?
On Sat, 10 Dec 2011, Bernd wrote: 2011/12/10 Michael Van Canneyt : Check the FTP server, somewhere in the 2.6 directory. Found it, Thanks. The reason I was looking for it was I wanted to know whether there has something changed with the optimization switches. But it seems this document still mentions things like -Or which the compiler complains is deprecated and one should use -Ooregvar. Where did you find this in the docs ? I just checked the doc sources. I don't find any mention of -Or ? Because even in the 2.4.4 docs, -Or was not mentioned ? Maybe some website/ftp site still contains an old version of the docs. Michael. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] IInterface type value and the "as" keyword
In our previous episode, Honza said: > after a long pause I'm trying to revive some code which I didn't touch > as long as early this year. At that time it compiled OK with trunk FPC > (I believe version 2.5.1). Early that year 2.5.1 was trunk yes. That same code is now the future fixes branch for 2.6, for which a RC1 is already available. > Now I'm trying to make that code work with > current stable (AFAICS that's 2.4.4) Correct, but it is relatively short before the 2.6.0 release, with a first RC1 already available. Since 2.6.0 might arrive this year still (or in the first week of the next), I suggest your focus your attention there, and forget about 2.4.4. > I suppose something has changed with the FPC interfaces and/or using > the "as" keyword in the above construct. Of course I searched e.g. the > "changes" wiki pages 2.4.0->2.4.2->2.4.4(and even ->2.6.0), but I > failed to find anything related, the same result for the mailing lists > and general googling attempts. And of course I tried every single > change to the code I could imagine may work. I assume it is bugfixed in 2.5+, which never made it back to the 2.4 series. > That said, I'm sure it's my fault to find the info or it's my fault in > some other way - me being blind to see something obviously wrong with > the code in the snippet, though I'm sure it used to compile w/o > problem before. It doesnt seem to be one of the major differences, so it is not a stupid question. (major ones I mean documented ones like: http://wiki.freepascal.org/User_Changes_2.6.0#IInterface.QueryInterface.2C_._AddRef_and_._Release_definitions_have_been_changed ) > Can please someone enlighten me? Thanks in advance, sorry for being dumb ;-) As said I think it is simply one of those minor bugfix related differences between the 2.4 and 2.6 (and +) series. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] IInterface type value and the "as" keyword
Hi list, after a long pause I'm trying to revive some code which I didn't touch as long as early this year. At that time it compiled OK with trunk FPC (I believe version 2.5.1). Now I'm trying to make that code work with current stable (AFAICS that's 2.4.4). Everything went smooth until compiler stumbled upon: function TheInterfaceListTest.Value(const It: IInterface): Integer; begin Result := (It as TInterfacedTracedObject).ID; // <-- line 238 end; with the error: "hecontnrs_list_test.pas(238,17) Error: class type expected, but got "IUnknown". FYI: TInterfacedTracedObject interface is: TInterfacedTracedObject = class(TInterfacedObject) private FID: Integer; FTracer: TBits; public constructor Create(const ATracer: TBits; const AID: Integer); destructor Destroy; override; property ID: Integer read FID; property Tracer: TBits read FTracer; end; I suppose something has changed with the FPC interfaces and/or using the "as" keyword in the above construct. Of course I searched e.g. the "changes" wiki pages 2.4.0->2.4.2->2.4.4(and even ->2.6.0), but I failed to find anything related, the same result for the mailing lists and general googling attempts. And of course I tried every single change to the code I could imagine may work. That said, I'm sure it's my fault to find the info or it's my fault in some other way - me being blind to see something obviously wrong with the code in the snippet, though I'm sure it used to compile w/o problem before. Can please someone enlighten me? Thanks in advance, sorry for being dumb ;-) Best regards, -bflm PS: Actually I found some recent discussions about FPC interfaces, but if I understood them correctly, no one of them seemed to me like an explanation for my problem. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] Re: Fatal: Internal error 200109227... and some boolean questions
I have filed a bug about the fatal error. http://bugs.freepascal.org/view.php?id=20874 Should I also file a bug about the other problem (IF not working properly with QWordBool) or is this intended or undefined behavior? ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal