I have a rather extensive comm unit created in Delphi for communication with a data acquisition instrument via RS232. The task is to port a project using this file to Lazarus on Linux. Thanks to advice here I have found a serial port component that works in similar ways to the one I have used in Windows, so now I am embarking on the porting task.
In the existing unit the serial port communication component is instantiated in code rather than being dropped on a form. Now I believe I have two options: 1) Sprinkle the code with conditionams for Delphi/Lazarus and use the 5dpo component and its specific calls for Lazarus and the existing code for Delphi. This will be rather ugly since the comm object FComm is used in many places in the code. or 2) Maybe I can somehow disguise the actual implementation of FComm from my existing code and instead create a 5dpo object in Lazarus and the other type in Windows, but give the wrapper the same properties and methods as the existing component has. This would involve wrapping 5dpo in a superclass, which translates the used properties/methods into 5dpo specifics. Then I would be able to select the proper one to make based on conditionals inside a different unit from my main unit. But how would this be done more specifically? Is there some description available on making code compatible between Delphi and Lazarus when there are component differences in the two systems as I described above? (I don't know if this is off-topic here and should be posted to the fpc list instead, but since GMANE does not yet allow posting to the fpc group I hope you will not be offended by me posting this question here. It seems like it is both a Lazarus vs Delphi question and one regarding subclassing...) Bo Berglund -- _______________________________________________ Lazarus mailing list [email protected] http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
