rodl2code / Invoker and Impl?

We move now from V8 to V9 and I try to replace Rodl.exe. But with the new Rodl2Code I have not yet the options to create an interface or invokers?!

The V9 ServiceBuilder does produce the nice code like

function LibrarySearchAsTexts(const language: MssWebLanguageType; const searchText: UnicodeString; const
… nicely aligned and useful

RODL.exe did exactly the same

but CodeGen2 does produce a code layout that does not fit at all to the ServiceBuilder one …
function LibrarySearchAsTexts(
const language: MssWebLanguageType;
const searchText: UnicodeString;
const caseSensitive: Boolean;
const wholeWords: Boolean;
const imageFormat: MssWebImageFormatType;
const targetDPI: Integer;

Now what to take to get the same output as ServiceBuilder does create?

rodl2code can’t generate delphi _invk and _impl.
will log.
I’ve attached simple delphi example which demonstrates how to create codegen4 gui codegen4_gui.zip (2.2 KB)

Thanks, logged as bugs://74974

Thank you. Looks already promising. I am building now a replacement tool for the old RODL.exe
One problem I have seen already in your sample code (adding FastMM4 for searching memory leaks)

res: TROCodegen4Files;

res:= cg4.Generate(RODL,Codegen4_Lang(cbLang.ItemIndex), Codegen4_Mode(cbMode.ItemIndex));

SetLength(res,0);

does not free the object in the TROCodegen4Files = array of TROCodegen4File
why not talking a TObjectList?

Feedback2: The service code looks now a lot better by using the codegen4 approach. But one thing I do not understand. V8 produced for Service-Implementation

TMssWebAPI = class(TRORemoteDataModule, IMssWebAPI)
public
procedure SymbolAsBinary(…);

V9 / ServiceBuilder + CodeGen4
procedure SymbolAsBinary(…); virtual;

Why suddently the methods of the service should be virtual?

you are right, that should be freed. you can use something like

    rec := gen.Generate(aLibrary, CG_GetCurrentLang, cg4m_Intf);
    for i := 0 to Length(rec)-1 do begin
..
      FreeAndNil(rec[i]);
    end;

Why suddently the methods of the service should be virtual?

this is for C++Builder compatibility.

FreeAndNil(rec[i]);

I do it already. Not a problem for my code. But see that actually as workaround. I still suggest to introduce a TObjectList.in the Delphi helper for CG4.

this is for C++Builder compatibility.

OK - not fully clear why this compatibility issues arrived between V8 and V9 and is important for a pure Delphi implementation?!

actually Delphi codegen shares logic with C++Builder codegen. it is reason for it.
Why this is the issue for you?

Why this is the issue for you?

Virtual indicates me that I will override the method somewhere else. But we talk about the implementation template of the web-service. What would be the exact use case for an override?

virtual means that it might be overridden, but you can omit overriding if it isn’t needed

bugs://D17515 was closed as outdated.