[fpc-devel] Import typelib extension
Hi all, I'm in the middle of adding to the typelib importer the automatic generation of a component implementing a sink for the events created by the com object. It'll use the EventSink object I wrote a while ago and will generate the components Onxxx properties and the corresponding function signatures. This will remove the burden of mapping dispids, retrieving and converting parameters to fpc compatible types (VT_BYREF !), etc. This is all fpc and would fit in with the current implementation of importtl.pas and typelib.pas. However, I just wrote a freepascal implementation of an Ole container (visual ActiveX container) and I would obviously like to integrate this also with the typelib importer to create also a complete (visual) component from an ActiveX typelib, including its event handlers and eventually the lpk to install the component in Lazarus. The Ole container is a descendant of TWinControl and obviously LCL. Comes my question: I would like to put the EventSink and the Ole container in a OleComponents unit in the winunits-base package to avoid a multiplication of units and directory paths. Is the use of {$ifdef LCL} to encapsulate the Ole container in a fpc unit acceptable or is this a herecy? The unit created by the typelib importer would also have parts inside {$ifdef LCL} Ludo ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
Re: [fpc-devel] Import typelib extension
In our previous episode, Ludo Brands said: I'm in the middle of adding to the typelib importer the automatic generation of a component implementing a sink for the events created by the com object. It'll use the EventSink object I wrote a while ago and will generate the components Onxxx properties and the corresponding function signatures. This will remove the burden of mapping dispids, retrieving and converting parameters to fpc compatible types (VT_BYREF !), etc. This is all fpc and would fit in with the current implementation of importtl.pas and typelib.pas. Good. However, I just wrote a freepascal implementation of an Ole container (visual ActiveX container) and I would obviously like to integrate this also with the typelib importer to create also a complete (visual) component from an ActiveX typelib, including its event handlers and eventually the lpk to install the component in Lazarus. The Ole container is a descendant of TWinControl and obviously LCL. Also good. Comes my question: I would like to put the EventSink and the Ole container in a OleComponents unit in the winunits-base package to avoid a multiplication of units and directory paths. No that is not possible. Is the use of {$ifdef LCL} to encapsulate the Ole container in a fpc unit acceptable or is this a herecy? Heresy, and worse, it will simply not work. A typical lazarus release then would have a FPC version with the LCL disabled and compiled with -Ur, and including the source directory might not force recompilation or lead to all kinds of vague errors (which is an unsupportable situation) I would say, two units, the visual part goes to Lazarus, and two different importtl options to enable the respective generations. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel
RE : [fpc-devel] Import typelib extension
Is the use of {$ifdef LCL} to encapsulate the Ole container in a fpc unit acceptable or is this a herecy? Heresy, and worse, it will simply not work. A typical lazarus release then would have a FPC version with the LCL disabled and compiled with -Ur, and including the source directory might not force recompilation or lead to all kinds of vague errors (which is an unsupportable situation) Understood, I didn't think about -Ur and/or the unit not always being recompiled. I would say, two units, the visual part goes to Lazarus, and two different importtl options to enable the respective generations. OK. Option 1: current CoClass extended with eventhandlers. Lifetime of Com object is managed by user. Option 2: ActiveXContainer (TWinControl) descendant with eventhandlers. Lifetime of Com object is managed by Component. Ludo ___ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel