Autogenerate C#/pas Intf file from Delphi code-first server

I have a Delphi code-first server that serves some C#.NET clients (Xamarin). I’d like to generate an Intf file whenever I make changes to the server. Ideally this could be performed in the post build event.

Currently I use a batch file that calls rodl2code with URL to generate c# Intf file, however there are two issues:

  • the server must be running
  • I have to use RO…HTTPServer, but I use supertcp to communicate with server in production

Maybe I’m missing something. I was used to autogenerated Intf files since all my servers was RODL-based and clients were Delphi only.

I also saw this feature in What’s New in Remoting SDK and Data Abstract 10 under ‘New in .1491, October 27, 2020 (Stable)’:

  • Improve generation of RODL from CodeFirst services

However I have no idea what that means and anyway I’m on version 9.7.115.1441.

Hi,

this is feature of the Code-First projects - RODL is generated on fly in runtime from RTTI information.

you should be able to use supertcp:// protocol too.

you can improve this process:

  • check Tool rocg4_helper topic, it contains simple rocg4_helper utility that shows how to generate files using uROCodegen4Helper.pas.
  • you can add some command line option for your server so it will be started, generates _Intf files via uROCodegen4Helper.pas and exits.

Note: developer pc with RO SDK installed is required for this solution.

check this topic at beta forum - it describes what exactly was improved:
https://talk.remobjects.com/t/remoting-sdk-for-delphi-vnext-new-features/18354/32

1 Like

I tried that before asking, but it seems that rodl2code then treats the parameter as file name (at least in version 9.7.115.1441):

> rodl2code.exe supertcp://host:port --type:intf --platform:.net --language:c#
Processing RODL file supertcp://host:port
File supertcp://host:port

Besides that, rodl2code prints this information when no parameters given (emphasis mine):

Remoting SDK Service Interface Code Generator, based on CodeGen4 (GitHub - remobjects/CodeGen4: A Swift library to generate source code for many languages)

Syntax:

rodl2code <rodl> --type:<type> --platform:<platform> --language:<language> --namespace:<namespace>
rodl2code <rodl> --service:<name> --platform:<platform> --language:<language> --namespace:<namespace>
rodl2code <rodl> --services --platform:<platform> --language:<language> --namespace:<namespace>

<rodl> can be:

  • the path to a local .RODL file
  • the path to a local .remoteRODL file
  • a http:// or https:// URL for a remote server

uROCodegen4Helper seems as a viable option for me that I’m going to explore further.

Many thanks for your help.

Hi,

C# is supported over supertcp:

I have followed your advice to add a command line switch to my service that allows me to generate Intf files using TROCodegen4 class. All was going well until I discovered that it internally uses 32-bit Codegen4Wrapper in-proc COM server. The problem is that my service is 64-bit, so the code generation fails (Class not registered) and I don’t want to maintain Win32 target just for this purpose. I’m not a COM wizard, so the question is whether it is possible to load 32-bit COM server into 64-bit app (maybe as an out-of-proc server)?

Otherwise I will just execute rodl2code.exe from within my service when the command line option for generating Intf is present.

Hi,
you can register it with

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\RegAsm.exe RemObjects.SDK.CodeGen4.dll

We will update install and this assembly will be registered in x64 space too.

1 Like

Maybe installer already registers the assembly for x64, but I do the manual installation process as discussed here:

I will update my scripts with x64 registration.