spspli
spspli

Reputation: 3338

How to keep the generated TLB file neat?

Hi I use interop to call C# code in Delphi. C# code has a binary and in Delphi 5 Menu: Project-->Import Type Library Click Add to add the tlb file: XXXX.tlb Unit dir name: input the path where the delphi XXX_TLB.pas file is generated.

If the C# dll, tlb and delphi XXX_TLB.pas has already been there. Now I add one more function in C# code and hope Delphi can call this function as well. I need to recompile c# and regenerate delphi XXX_TLB.pas file. But by following the above steps, I see the newly generated XXX_TLB.pas includes my newly added function, but looks like the functions order in XXX_TLB.pas is totally different from before.

For example, in my C# binary I have function: func1(); func2(); func3(); func4();//newly added

In the old XXX_TLB.pas, the function order is: func1(); func2(); func3(); Now XXX_TLB.pas is like this: func1(); func3(); func4(); func2();

The XXX_TLB.pas can still be used, looks like no functionality difference, but when I check in to tfs, I see it changes a lot from pervious version. Is there a way to keep this new XXX_TLB.pas the same order as before but add my function as well? How to do that? Thanks!

Upvotes: 2

Views: 1737

Answers (2)

Willem van Rumpt
Willem van Rumpt

Reputation: 6570

You can't, as far as I know. I most cases, I'm able to consider them as a sort of "black box" anyway, and only occasionally have to peek in them to find a specific declaration.

Upvotes: 2

David Heffernan
David Heffernan

Reputation: 612904

You cannot hope to keep the changes to a minimum unless you start writing the .pas file yourself. That sounds like a worse option.

Probably what is happening is that you have changed version of either one of your compilers since the last time you imported. Otherwise one would expect minimal differences.

Just check it in with a comment stating which versions of compiler and .ocx/.dll were used.

Upvotes: 2

Related Questions