Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2007-05

delphi compatibility issues

5 messages · 4 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Mario R. Carro

Hi, I'm trying to compile the JCL with FreePascal (the common, unix and vcl folders). Excluding the portability errors in the JCL, I found some issues that I think could be best solved by FPC (and benefit the porting of any other Delphi project also). I'm using FPC from SVN (updated daily).

Here is a little list:

- Some assembler does not compile. For example this function, in JclLogic.pas:

procedure SetBitBuffer(var Value; const Bit: Cardinal);
asm
  BTS    [Value], Bit
end;

This unit can be compiled with FPC defining PUREPASCAL but with degraded performance in many functions.

- Interface implementation delegation requires an interface type (but Delphi accepts classes). For example, in JclSchedule.pas:

    property DailyFreq: TDailyFreq read FDailyFreq implements
IJclScheduleDayFrequency;

where TDailyFreq is a class (derived from TAggregatedObject).

- Classes implementing interfaces must implement all the interface methods (but Delphi compiles the code happily without them). See, for example, the class TSchedule in JclSchedule.pas. Adding virtual abstract declarations for the missing methods to the class solves the problem in FPC in a Delphi compatible way. Perhaps FPC should do it automatically in those cases?

- THashedStringList does not exist. I already posted a bug implementing this class, but it didn't reach SVN yet.

Comments are welcome. Please let me know if you think any of them should be solved on the JCL side.

Thanks,
Mario

Reply by email

Jonas Maebe
to Mario R. Carro
Mario R. Carro wrote 11 lines
- Some assembler does not compile. For example this function, in JclLogic.pas: procedure SetBitBuffer(var Value; const Bit: Cardinal); asm BTS [Value], Bit end; This unit can be compiled with FPC defining PUREPASCAL but with degraded performance in many functions.

Please submit a bug for this.

Show quoted text 8 lines
- Interface implementation delegation requires an interface type (but Delphi accepts classes). For example, in JclSchedule.pas: property DailyFreq: TDailyFreq read FDailyFreq implements IJclScheduleDayFrequency; where TDailyFreq is a class (derived from TAggregatedObject).

For this also.

Show quoted text 8 lines
- Classes implementing interfaces must implement all the interface methods (but Delphi compiles the code happily without them). See, for example, the class TSchedule in JclSchedule.pas. Adding virtual abstract declarations for the missing methods to the class solves the problem in FPC in a Delphi compatible way. Perhaps FPC should do it automatically in those cases?

To me, this sounds like a bug in Delphi, although we may emulate it one day in Delphi mode. Either a class implements an interface, or it doesn't. I think it's better to solve this on the JCL side.

Jonas

Reply by email

Marc Weustink
to Mario R. Carro: Hi, I'm trying to compile the JCL with FreePascal (the common, unix and vcl folders).…
Mario R. Carro wrote 27 lines
Hi, I'm trying to compile the JCL with FreePascal (the common, unix and vcl folders). Excluding the portability errors in the JCL, I found some issues that I think could be best solved by FPC (and benefit the porting of any other Delphi project also). I'm using FPC from SVN (updated daily). Here is a little list: - Some assembler does not compile. For example this function, in JclLogic.pas: procedure SetBitBuffer(var Value; const Bit: Cardinal); asm BTS [Value], Bit end; This unit can be compiled with FPC defining PUREPASCAL but with degraded performance in many functions. - Interface implementation delegation requires an interface type (but Delphi accepts classes). For example, in JclSchedule.pas: property DailyFreq: TDailyFreq read FDailyFreq implements IJclScheduleDayFrequency; where TDailyFreq is a class (derived from TAggregatedObject). - Classes implementing interfaces must implement all the interface methods (but Delphi compiles the code happily without them).

Ow ?
I've coded a lot if interfaces with D6 and luckely it complained if I forgot to implement some of them.

What version of Delphi did you use ?

Marc

Reply by email

Mario R. Carro
to Marc Weustink
Marc Weustink wrote 36 lines
Mario R. Carro wrote: > Hi, I'm trying to compile the JCL with FreePascal (the common, unix and > vcl folders). Excluding the portability errors in the JCL, I found some > issues that I think could be best solved by FPC (and benefit the porting > of any other Delphi project also). I'm using FPC from SVN (updated > daily). > > Here is a little list: > > - Some assembler does not compile. For example this function, in > JclLogic.pas: > > procedure SetBitBuffer(var Value; const Bit: Cardinal); > asm > BTS [Value], Bit > end; > > This unit can be compiled with FPC defining PUREPASCAL but with degraded > performance in many functions. > > - Interface implementation delegation requires an interface type (but > Delphi accepts classes). For example, in JclSchedule.pas: > > property DailyFreq: TDailyFreq read FDailyFreq implements > IJclScheduleDayFrequency; > > where TDailyFreq is a class (derived from TAggregatedObject). > > - Classes implementing interfaces must implement all the interface > methods (but Delphi compiles the code happily without them). Ow ? I've coded a lot if interfaces with D6 and luckely it complained if I forgot to implement some of them. What version of Delphi did you use ?

Hi, I'm using D7. But you are right. This is a consequence of the previous problem: That class implements many interfaces by way of "implementation properties" that FPC does not accept yet (as detailed above), hence all the methods of the interfaces that should have been delegates to that properties remain undefined and FPC complains (rightly).

Marc

Thanks,
Mario

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

Reply by email

Flávio Etrusco
to Mario R. Carro
> Ow ? > I've coded a lot if interfaces with D6 and luckily it complained if I > forgot to implement some of them. >

OTOH if the "abstract" keyword for classes was introduced/implemented in FPC it would be nice to have "partial interface implementation" just like Java ;-)

Cheers,
Flávio

Reply by email