FPC 2.0.2 issue (interfaces) lazarus / 8-Other ---------------------------------------------------------------------- jrmarino · 2006-03-08 12:29 I'm trying to port a database wrapper for mysql 4.1 and 5.0 (native API calls) to FPC.  I've run up against something I don't understand, and I want to get a ruling if this is a bug or something else. Basically I defined an interface, a unit variable, and an abstract class e.g Code: [Select] type    IZDriverManager = interface (IZInterface) ['{GUID}']       methods   end;   var       DriverManager: IZDriverManager;   type       TZDriverManager = class (TinterfacedObject, IZDriverManager)            variables/methods       end; Then later in an initialization block, I have:   DriverManager := TZDriverManager.create;   writeln ('testing: ' + intToStr(DriverManager.GetLoginTimeOut); It compiles using delphi mode just fine.  It appears to successfully instanciate the DriverManager variable.  However, any attempt to manipulate it will result in runtime error 210, as if the object variable was never initialized. This works just fine in Delphi.  Is it a limitation with FPC, or is it a straight up bug?  Anyone run into this before?[/code] ---------------------------------------------------------------------- jrmarino · 2006-03-08 13:43 It's starting to look like a straight-up bug.  I made this little program in delphi: Code: [Select] program fpc_error; {$APPTYPE CONSOLE} uses   SysUtils,   Unit1 in 'Unit1.pas'; var     DriverManager: IZDriverManager; begin     DriverManager := TZDriverManager.create(5);     writeln (Drivermanager.getMessage); end. Code: [Select]unit Unit1; interface type     IZDriverManager = interface (IInterface)     ['{38736671-5CC9-4822-AE2E-08CDB0CAE58B}']         function getMessage: AnsiString;     end;     TZDriverManager = class (TInterfacedObject, IZDriverManager)     private         dummy: Byte;     public         function getMessage: AnsiString;         constructor create (dontcare: Byte);     end; implementation constructor TZDriverManager.create(dontcare: Byte); begin     self.dummy := dontcare; end; function TZDriverManager.getMessage; begin     Result := 'Well, that worked!'; end; end. Then I made minor changes to run it in FPC: Code: [Select] program fpc_error; uses   SysUtils,   Unit1 in 'Unit1.pas'; var     DriverManager: IZDriverManager; begin     DriverManager := TZDriverManager.create(5);     writeln (Drivermanager.getMessage); end. Code: [Select] unit Unit1; {$MODE DELPHI} interface type     IZDriverManager = interface (IInterface)     ['{38736671-5CC9-4822-AE2E-08CDB0CAE58B}']         function getMessage: AnsiString;     end;     TZDriverManager = class (TInterfacedObject, IZDriverManager)     private         dummy: Byte;     public         function getMessage: AnsiString;         constructor create (dontcare: Byte);     end; implementation constructor TZDriverManager.create(dontcare: Byte); begin     self.dummy := dontcare; end; function TZDriverManager.getMessage; begin     Result := 'Well, that worked!'; end; end. The delphi program runs after printing, "Well, that worked!".  The FPC program ends with an Runtime error 210. ---------------------------------------------------------------------- jrmarino · 2006-03-09 09:36 okay, this is a bug and it's already been reported back in november, but it hasn't been fixed yet. http://www.freepascal.org/bugs/showrec.php3?ID=4510 Turns out you can get around it by disabling range checking, but I hope the developers fix it soon.  I'm a bit concerned because looking at the unfixed bug list, there are some significant ones on the list, and they are coming in faster than they are getting fixed. ---------------------------------------------------------------------- Vincent Snijders · 2006-03-09 14:52 Quote from: "jrmarino"I'm a bit concerned because looking at the unfixed bug list, there are some significant ones on the list, and they are coming in faster than they are getting fixed. Yes, fpc got too popular before it is finished. ---------------------------------------------------------------------- felipemdc · 2006-03-10 01:55 Quoteokay, this is a bug and it's already been reported back in november, but it hasn't been fixed yet. http://www.freepascal.org/bugs/showrec.php3?ID=4510 Turns out you can get around it by disabling range checking, but I hope the developers fix it soon. If you really need that fixed soon, I suggest that you: a) submit a patch yourself or b) pay someone to make a patch QuoteI'm a bit concerned because looking at the unfixed bug list, there are some significant ones on the list, and they are coming in faster than they are getting fixed. This only says that are few developers and lot's of users =) But I'm am pretty amazed at the amount of things I did with Free Pascal + Lazarus without hitting any really serious bug of Free Pascal. ---------------------------------------------------------------------- jrmarino · 2006-03-10 09:21 Let me preface by saying I basically support OSS and have made past contributions.  In fact, I'm only a couple of days away from releasing a new database API using native MySQL 4.1 and 5.0 libraries, which supports native prepared statements and bindings, among others.  This API runs under delphi and FPC 2.0.2 without modification and it's possible that it may be very popular here. That being said, Sekel, I found your response inflamatory.  It's also not original.  All OSS zealots spout that exact phrase, and it is only a negative thing. For A) assume 85% of the people don't have the skill to do it.  Of the remaining 15%, 90% probably don't have the time to do it.  Of the remaining, 80% probably don't care enough to do it.  And we aren't even discussion how long it would take someone to get up to speed with the code from scratch.  I find the suggestion to "submit a patch yourself" to be antagonistic, pretty much in all circumstances.  Antigonising others serves no purpose. for B) no thanks. Look, there's some responsibility that goes along with an OSS project.  If you just release the code, expect it to die.  If you actively sponser it, you're assuming the responsibility to maintain it.  If the code is NOT going to be maintained, this needs to be proclaimed boldly.  After all the hoopla with the release of version 2.0.0, I was under the impression that there is a committed community to that compiler.  I'm still under that impression.  We all know there is an iterative cycle of release - find bug - report bug - fix bug - release.  During that time, the user base increases, because the code is less and less buggy.  If the cycle stops at "fix bug", then it's over. And one more thing: Even if I pay for this patch, what happens when I run into the next show stopper bug?  It only takes one or two of these before people dismiss the entire thing as too buggy and look for a more solid solution.  And telling good-meaning people taking the time to submit a bug report to "fix it your damn self" is probably not the best way to gain userbase, which I interpret as a goal of the FPC project.  Please don't tell me this is one of those "Love it or leave it" projects like PHPBB. ---------------------------------------------------------------------- FPK · 2006-03-10 09:47 This bug is already fixed. I wasn't aware that there is a bug report. 2006-03-05 18:33 florian r2762   /trunk/compiler/: ncgutil.pas   * test vmt only for classes and objects Will close it after verification. Paying per patch is nonsense. The fair solution is to pay for the porting of a certain project if paying is an option. At least Jonas and me did this already for people. The number of bugs increases currently indeed. The main reason are the increasing users. Anyways, most of them aren't that serious, MS would call them issues ---------------------------------------------------------------------- tech-pro · 2006-03-10 10:14 jrmarino, I agree with what you say. It's a sad fact that most OSS projects that reached commercial quality did so because some big businesses found it worthwhile to invest money in their development. If a project relies on enthusiastic volunteers working in their spare time then progress is painfully slow. If I found a bug that I could fix then I would happily do so, but like most Delphi programmers I am not experienced working at a low level. I think the world needs an open source Pascal compiler whose future is not wholly at the mercy of commercial decisions. It is a great pity that there is not a commercial company who would find it in their interest to invest some money in Free Pascal / Lazarus. While these problems exist, it is hard to persuade professionals that FPC/Lazarus is anything more than a tool for hobbyists for whom a bug in the development system is merely an annoyance, not a serious and potentially expensive setback. ---------------------------------------------------------------------- felipemdc · 2006-03-10 10:41 QuotePaying per patch is nonsense. It does work like that on wxWidgets. Quotejrmarino, I agree with what you say. It's a sad fact that most OSS projects that reached commercial quality did so because some big businesses found it worthwhile to invest money in their development. If a project relies on enthusiastic volunteers working in their spare time then progress is painfully slow. The development is payed one way or another. Maybe it's payed only with the time of the main developers, then you can see that the amount of resources available is scarse. ---------------------------------------------------------------------- jrmarino · 2006-03-10 11:44 Florian, Thank! I apologize, I submitted a duplicate bug report #4885 before I found bug report 4510, so feel feel to close it at the same time as 4510. Sorry, my comment about bug reports coming in faster than the fixes was innocent, I wasn't trying to get a flame war started.  Just wishing some of the worst "features" were addressed, that all.