classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view


José Mejuto

A few days ago I was trying to convert a COM DLL into a *_TLB.pas file
using the importtl.exe and the result does not compile at all due some
missing parameter names in some functions/procedures.

After note that typelib.pas is the heart of the importtl.exe file I was
looking for the reason and fixes the bug and proposed a patch in this
bug report


After this patch the code is compilable but some functions fails with a
SIGSEGV. Looking at code again I found that some function names
"AddRef", "Invoke" and others that are present in base interface
(IUnknown and IDispatch) are removed from the generated output.
After comment out this lines the code generated works mostly as expected
(except another bug explained later) and a function "AddRef" appears in
the middle of some interface definitions.

So my question is. Is fpc binding interface functions based in its index
? I think the answer is yes so removing that "reserved" names crash the
binding when a custom function with that name appears in the middle of
an interface.

To solve this problem there are 2 solutions from my point of view, one
is add it as is as (what my internal patch does now) or rename the
function so it does not clash with inherited "AddRef" in example.

The other bug is that I had found intefaces which export a property_put
with ByRef parameter, so it can not be mapped to a pascal property, so I
had changed this conflictive functions to no emit a "property read" code.

Currently tipelib.pas generated code like this interface:

procedure Set_Value(var Param1: Widestring);
function  Get_Value: WideString;
property Value read Get_Value write Set_Value;

Which can not be compiled due the "var" in the Set_* procedure.

I hope that one devel can review and apply the patch in the bug report
noted above.

Best regards,
        José Mejuto

fpc-pascal maillist  -  [hidden email]
Reply | Threaded
Open this post in threaded view

Re: typelib.pas

Anthony Walter-3
I wrote a tool to make type library imports fast and easy. Try it out:

If you guys like it I can try to locate my sources and donate them.

fpc-pascal maillist  -  [hidden email]