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

**URL:** https://talk.remobjects.com/t/autogenerate-c-pas-intf-file-from-delphi-code-first-server/25010
**Category:** Remoting SDK
**Tags:** net, delphi
**Created:** [July 1, 2021, 2:36pm UTC](https://talk.remobjects.com/t/autogenerate-c-pas-intf-file-from-delphi-code-first-server/25010 "2021-07-01T14:36:44Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![juraj.polacok](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/j/9de0a6/32.png) [@juraj.polacok](https://talk.remobjects.com/u/juraj.polacok)
#### Post date: [July 1, 2021, 2:36pm UTC](https://talk.remobjects.com/t/autogenerate-c-pas-intf-file-from-delphi-code-first-server/25010/1 "2021-07-01T14:36:45Z")

</div>

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](https://www.remotingsdk.com/ro/whatsnew/) 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.

---

<div class="post-metadata">

### Author: ![EvgenyK](https://talk.remobjects.com/user_avatar/talk.remobjects.com/evgenyk/32/16_2.png) [@EvgenyK](https://talk.remobjects.com/u/EvgenyK)
#### Post date: [July 1, 2021, 3:25pm UTC](https://talk.remobjects.com/t/autogenerate-c-pas-intf-file-from-delphi-code-first-server/25010/2 "2021-07-01T15:25:33Z")

</div>

Hi,

> [@juraj.polacok](#):
>
> the server must be running

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

> [@juraj.polacok](#):
>
> I have to use RO…HTTPServer, but I use supertcp to communicate with server in production

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

> [@juraj.polacok](#):
>
> Currently I use a batch file that calls rodl2code with URL to generate c# Intf file

you can improve this process:

- check [Tool rocg4\_helper](https://talk.remobjects.com/t/tool-rocg4-helper/22749) 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._

> [@juraj.polacok](#):
>
> I also saw this feature in [What’s New in Remoting SDK and Data Abstract 10](https://www.remotingsdk.com/ro/whatsnew/) under ‘New in .1491, October 27, 2020 (Stable)’:
> 
> - Improve generation of RODL from CodeFirst services

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](https://talk.remobjects.com/t/remoting-sdk-for-delphi-vnext-new-features/18354/32)

---

<div class="post-metadata">

### Author: ![juraj.polacok](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/j/9de0a6/32.png) [@juraj.polacok](https://talk.remobjects.com/u/juraj.polacok)
#### Post date: [July 2, 2021, 11:25am UTC](https://talk.remobjects.com/t/autogenerate-c-pas-intf-file-from-delphi-code-first-server/25010/3 "2021-07-02T11:25:52Z")

</div>

> [@EvgenyK](#):
>
> you should be able to use `supertcp://` protocol too.

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](https://github.com/remobjects/codegen4))
> 
> 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.

---

<div class="post-metadata">

### Author: ![EvgenyK](https://talk.remobjects.com/user_avatar/talk.remobjects.com/evgenyk/32/16_2.png) [@EvgenyK](https://talk.remobjects.com/u/EvgenyK)
#### Post date: [July 2, 2021, 11:39am UTC](https://talk.remobjects.com/t/autogenerate-c-pas-intf-file-from-delphi-code-first-server/25010/4 "2021-07-02T11:39:08Z")

</div>

Hi,

C# is supported over supertcp:

 ![untitled](https://talk.remobjects.com/uploads/default/original/2X/f/f2cbf7577ca1b6820d7385cfb8b95be78a21a785.png)

---

<div class="post-metadata">

### Author: ![juraj.polacok](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/j/9de0a6/32.png) [@juraj.polacok](https://talk.remobjects.com/u/juraj.polacok)
#### Post date: [July 2, 2021, 1:06pm UTC](https://talk.remobjects.com/t/autogenerate-c-pas-intf-file-from-delphi-code-first-server/25010/5 "2021-07-02T13:06:21Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![EvgenyK](https://talk.remobjects.com/user_avatar/talk.remobjects.com/evgenyk/32/16_2.png) [@EvgenyK](https://talk.remobjects.com/u/EvgenyK)
#### Post date: [July 2, 2021, 1:54pm UTC](https://talk.remobjects.com/t/autogenerate-c-pas-intf-file-from-delphi-code-first-server/25010/7 "2021-07-02T13:54:11Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![juraj.polacok](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/j/9de0a6/32.png) [@juraj.polacok](https://talk.remobjects.com/u/juraj.polacok)
#### Post date: [July 2, 2021, 3:40pm UTC](https://talk.remobjects.com/t/autogenerate-c-pas-intf-file-from-delphi-code-first-server/25010/15 "2021-07-02T15:40:22Z")

</div>

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

> [@Manual installation of RemObjects SDK](https://talk.remobjects.com/t/manual-installation-of-remobjects-sdk/23125):
>
> I’m trying to get RemObjects SDK into source control since I need to support multiple versions of my application that was compiled with different version of library (9.7.115.1441 and 10.0.0.1485). This would allow me to: rapidly switch between two version of my application make initial setup of development environment easier For that purpose I performed these steps: I backed up original installation files. I uninstalled RemObjects SDK. I added BPLs, DCUs, DCPs and optionally source code fil…

I will update my scripts with x64 registration.
