[fpc-devel] Import typelib extension
Marco van de Voort
marcov at stack.nl
Fri Dec 30 14:13:50 CET 2011
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.
More information about the fpc-devel
mailing list