You are browsing the archive for Delphi.

Profile photo of evgenyk

by evgenyk

“Code-First” Servers in RemObjects SDK 9 for Delphi [BETA]

September 23, 2015 in Data Abstract, Delphi, RemObjects SDK

Just as we have done for .NET, with the latest beta we’re bringing Code-First Servers to Delphi, as well.

To recap, Code-First lets you define your services and related types in Code and have them published on the fly, without having to first define a RODL file Service Builder.

You simply define your service classes and attach a couple of attributes to make them available remotely, and RemObjects SDK will take care of the rest and make sure they become callable. The same goes for any enums and structures these services use.

At runtime, RemObjects SDK will generate a RODL representation of your services based on the types it finds in your app and make that available to download for clients. So to the outside, a Code-First looks identical to a traditional RODL-driven server, and for the use on the client, you can still import the (now auto-generated) RODL from your IDE or the codegen tool to generate client interface stubs.

Let’s see how Code-First services look like in Delphi:

Converting an Existing Server

You probably already have existing RO servers, so let’s have a look at how to convert one to the new model. To be clear, you don’t have to convert your servers to Code-First in order to use RO9. This is not a breaking change, just a new option.

Just as on .NET, there are really just four steps involved in making the switch, all of them simple, and two of them automated:

  1. Adjust your existing Service implementations
  2. Convert our auxiliary types, such as structs, arrays, event sinks and enums
  3. Remove your RODL file and the auto-regenerated _Intf, _Invk and _Async files generated from it
  4. Add one statement of code to configure your server for Code-First

Adjusting Your Existing Services

Since your service implementation files consider code you write explicitly, we won’t auto-convert them for you. But switching them over to Code-First is easy. For each of your services, you just follow these steps:

  • Add the new [ROService] attribute
  • Add the [ROServiceMethod] attribute to each service method you want to publish
  • Remove the IServiceName interface from the ancestor list
  • Change the invoker from TServiceName_Invoker to TRORTTIInvoker

In essence, you’d go from something like

TLoginService = class(TSimpleLoginService, ILoginService)
fClassFactory := TROClassFactory.Create('LoginService', Create_LoginService, TLoginService_Invoker);

to just

TLoginService = class(TSimpleLoginService)
fClassFactory := TROClassFactory.Create('LoginService', Create_LoginService, TRORTTIInvoker);

You will also need to add two new units to the uses section of your code, uRORTTIAttributes and uRORTTIServerSupport.

Note that you don’t necessarily need to convert all services to be Code-First in one go. You can start by converting some of your services and deleting them manually from the RODL, and leaving others RODL-based. Of course in that case you will want to delay the next two steps until you’re ready to switch the last service over.

At runtime, RemObjects SDK will take care of merging what’s in your RODL and what’s defined “Code-First” and make sure it all works together.

Event Sinks

The syntax for event sinks has changed slightly for Code-First servers, replacing the auto-generated sink-specific Writer
with the new generic IROEventWriter<T>. So your event sink code changes from this:

var chateventswriter: IHTTPChatEvents_Writer;
  chateventswriter := (EventRepository as IHTTPChatEvents_Writer);
  chateventswriter.OnSendMessage(Session.SessionID, thisuserid, aMessageText, aDestination <> '');

to this:

var chateventswriter: IROEventWriter<IHTTPChatEvents>;
  chateventswriter := EventRepository.GetWriter<IHTTPChatEvents>(Session.SessionID);
  chateventswriter.Event.OnSendMessage(thisuserid, aMessageText, aDestination <> '');

Note: the old syntax is still supported for event sinks defined in RODL.

Converting Auxiliary Types

Next, let’s look at all the additional types you may have defined in the RODL to help your services: Enums, Structs, Exceptions or Arrays (although Arrays defined in RODL don’t really reflect in generated code).

In code, these all lie in the _Intf file that you normally don’t touch, because it gets updated from the RODL when that changes. Since the RODL is going away, this auto-updating won’t happen anymore, so you are, in a way, “taking ownership” of these classes now.

You could just keep the _Intf file around, but there’s a ton of extra crud in there that you no longer need, and that would make it hard to maintain/update in the future. So really, it makes sense to clean that up. Just like in .NET, we have a small wizard in the Delphi IDE that takes care of this *and* the next step for you (but that’s not in the current beta drop, yet).

Remove the RODL and Auto-Generated Code

Once we’ve taken care of the auxiliary types, the RODL file and the three source files generated from it (but not the services!) can simply be removed from the server project and deleted.

Bye bye RODL, it was nice to have known you.

Configure Code-First

As a last step, you can optionally add this line of code to your server to configure the “name” of your server, as it will be exposed externally (in the RODL that clients will download). If it is not set, your .exe name will be used.

uRORTTIServerSupport.RODLLibraryName := 'MyServer';

Press “Run”

And with that, your server is converted and ready to run. When you launch and go to http://localhost:8099/bin, you will still see the familiar RODL representation of your server, only now it is driven by the code in your project, not the other way around.

Creating New Services

As you can imagine, creating new services (or a whole new server) will be super easy with the new model, as well.

To add a new service to your existing server, simply add a new class, attach the [ROService] attribute, and mark the methods you want published with [ROServiceMethod]. Done. If you need new structs or enums, simply define them in code.

To create a brand new server, you can use the new “Code-First” project templates as a starting point.


We’ve only scratched the surface of Code-First services in this article, but I hope it gave you a good introduction and will help you get started with the feature.

Let us know what you think, how it’s working out for you, and what you would like to see improved.

Profile photo of marc

by marc

Announcing Data Abstract and RemObjects SDK 8.3

May 27, 2015 in "Silver", Data Abstract, Delphi, Visual Studio

We’re happy to announce that we just shipped Data Abstract and RemObjects SDK 8.3, a set of significant updates to our flagship emoting and multi-tier frameworks.


Probably the most exciting change for Delphi users in this release is the inclusion of support for the “NEXTGEN” Delphi compiler, and with that support for building FireMonkey applications for iOS and Android in Delphi. We know that many of you felt strongly about being able to use Delphi to build apps for these platforms, and with DA8.3 you now can.

This support of course comes in parallel with our existing support for building apps for these platforms with out native libraries for Cocoa and for Java, respectively. Our platform-native libraries will continue to be a major focus point, and our recommended solution for building great mobile apps.


Version 8.3 also adds official support for using RO/DA in combination with our new a (and free) Silver compiler that we shipped last month. You can now use Data Abstract and RemObjects SDK to build clients and servers using the Swift language. Servers can be created for .NET/Mono, and clients are of course supported for .NET/Mono, Cocoa and Java/Android.

This is a change that should be exciting booth existing RO/DA users who want to use Swift, as well as to existing Swift developers looking to write server code to accompany their client apps.


This release also adds official support for Visual Studio 2015 (Release Candidate, or later), and includes tentative support for Fire, our new native development environment for Mac.

You can use DA with all three Elements languages (Oxygene, C# and Swift) in Fire, and in Visual Studio it of course supports Visual C# and Visual Basic, as well.


Version 8.3 is available now, both as full versions for licensed users, and as free trial. As always, this is a free update for all users with an active subscription.


Profile photo of marc

by marc

Data Abstract, RemObjects SDK and Hydra “Spring 2014” Releases

March 31, 2014 in .NET, Cocoa, Data Abstract, Delphi, Hydra, Java

On Friday, we released the latest updates to our Data Abstract and RemObjects SDK products for all five platforms, as well as for Hydra. Like always, a whole bunch of fixes and improvements across the product lines are gathered together in this release.

For Data Abstract and RemObjects SDK, this is also our last planned release for the 7.0 product version, as we prepare for a major new product cycle — codenamed DA8 — starting with our summer release in May. As such, this update focuses mainly on bug fixes and smaller enhancements (of which there are many).

The new release also includes official support for use with our recently released RemObjects C#, including project templates and IDE improvements to let you build .NET, Cocoa and Java apps with RO/DA using our C# implementation, as well as building managed hosts and plugins for Hydra.

As always, the new update is free for all users with an active subscription, and available on the customer portal. Our free 30-day trial downloads have also been updated to the new version.

If your subscription has elapsed, then now is a great time to renew. Renewing will not only give you access to the new 7.0 update, but also access to the beta versions of DA8 that will become available over the course of April, as well as the first (and future) DA8 or RO8 releases throughout the year.

If your previous subscription ended a while ago, you will be happy to hear that we recently updated our online shop to automatically grant “amnesty renewals”. That means you can be assured that your renewed license will always cover the current product and at least six months of future updates from your renewal date.

If you have or are considering getting a Suite subscription, remember that the Suites for .NET, Cocoa and Java now also include RemObjects C# — so you get been more value at the same great price as before (and you can always up-renew from RO or DA to the Suite, of course).

But enough talk, i’m sure you’re anxious to try out the new bits. We’re happy to have this new set of updates out to you now, and we’re extremely excited about what we have coming for DA8 and RO8 this summer and beyond.

marc hoffman
Chief Architect

Profile photo of marc

by marc

…then i might as well learn Java?

April 23, 2013 in .NET, Cocoa, Delphi, Elements, iOS, Java, Windows

One of the most frequent comments i hear when people dismiss or decide against considering Oxygene as their development tool of choice goes along the lines of the title of this blog post:

“With Oxygene i need to learn all the new platform APIs. If that’s the case, i might as well learn C# [or Java or Objective-C].”

That’s certainly true. When moving to and learning a new platform, there’s a vast number of things to learn — new classes, new APIs, new concepts, new ways of doing things. Learning a new language, especially if it’s one from the same broader family of languages you already know (i.e. Object Oriented languages) is only a small and insignificant part of that.

But, i think it is missing the point of Oxygene, to think its whole reason d’être is to save you from learning a new language. Quite the contrary.

Oxygene is based on Object Pascal, and is, at its root, very close to the “Delphi” language (which basically represents the state-of-the-art of Object Pascal ca. 2003). The main reason for that is not that Delphi developers (which the creators of Oxygene were too, at the time) do not have to learn a new language. The reason for that is that Pascal — as much as it has gone out of fashion over the past 20 or so years — is a freaking amazing base point for a programming language. It’s clean, well structured, easy to learn, and — very importantly — easy to read.

Many developers underestimate this, but they spend a lot more time re-eading their (and other’s) code than they originally spent writing it — so having a language that makes code easy to parse and understand by the human brain is a very important and undervalued feature of a language. One that Oxygene shines at like no other.

So that’s the why Oxygene is what it is, but is that enough reason to choose it over C#, Java or even Objective-C? No, of course not.

The biggest selling point for Oxygene in my opinion is not that it’s Pascal based, and is not that is allows you to natively compile for today’s three major platforms (.NET, Java and Cocoa) with the same code base, and it most certainly not that it saves you from doing anything (be it learning a new language, or be it spending more money on a more expensive development tool).

The biggest selling point of Oxygene is — quite frankly — that it is an amazing modern language, with features that developers using the other mainstream languages don’t even begin to dream about.

Going into details on all the features that make Oxygene unique and powerful, the features that will change your life as a developer, would require several posts on its own. But the scope ranges from Class Contracts to language-integrated parallelism, from nullable types to the amazing Future types, from small but powerful things like the colon operator and double boolean comparisons to “for” loop expressions (not to be confused with regular “for” loops), and from duck typing to language-native tuples.

The list could keep going on.

So when you’re looking at Oxygene (and i know you are), don’t just look at it from the perspective that it will let you keep coding in Pascal without having to learn a new language. Sure, that’s a big factor too. If you’re a Delphi developer, you probably love Pascal (like we do), and have been using it for the past 10, 20 or even more years. And being Pascal certainly is one thing that makes Oxygene attractive to you.

But don’t stop there; you’re doing Oxygene and yourself an injustice, if you look at that as the main benefit.

Instead, think of using Oxygene as switching to the most powerful and modern object oriented language out there, today. That it’s Pascal-based is just the icing on an already very delicious cake.

Wiki This Week – Delphi Edition

August 28, 2012 in Data Abstract, Delphi, Hydra

Welcome to Wiki This Week, the blog post where we outline some of the recent updates to our documentation Wiki. We’ve had a number of recent updates involving Delphi related wiki articles, so this post is focused just on those.

  • RemObjects SDK Plugins with Hydra – This is a great combination of our RemObjects SDK and Hydra products to create a pluggable RemObjects SDK server that loads different services at runtime, adjusting RODL resources dynamically.
  • RemObjects SDK Class Factories Sample – This sample demonstrates how to use a Class Factory to generate three types of server: Single call, Singleton, Pooled.
  • Auto Server Sample – This sample gives a practical example of how a client can control the server when they are both running locally. This is useful if you want to provide a simple standalone solution which is easily upgradeable to work over the network (or you might want to provide both options).
  • Async Sample – This sample demonstrates how to call methods on a RemObjects SDK server asynchronously. This means that the main application thread is not blocked while waiting for the method execution results. This may be especially useful in cases where the operation takes a significant amount of time, so you may submit a request and defer receiving the result for later without creating background threads.
  • Arrays Sample – This sample shows how to use Arrays and Structs for representing database tables and a master/detail relationship.
  • Broadcast Chat Sample – This sample demonstrates how to use the Indy-based channels TROBroadcastServer and TROBroadcastChannel to write an UDP broadcasting chat program.

We’re continuing to keep wiki documentation updates a priority and this is just a small portion of recent changes, so check the wiki regularly.

Summer’s Here!

June 12, 2012 in .NET, Cooper, Data Abstract, Delphi, Hydra, JavaScript, Metro, Relativity, Visual Studio

Change LogsJust in time for the start of summer, our “Summer 2012” releases are here! There are significant updates in every single one of our products — three editions of Data Abstract, four editions of RemObjects SDK (the new one being RemObjects SDK for Java), both editions of Oxygene, and Hydra.


The big theme this time around is our preliminary support for Metro and Windows 8. Since Windows 8 and Visual Studio 11 are in Release Preview right now, our support is preliminary, but rest assured that when they get released we will have finalized support right away. This means you can start developing native Windows 8 Metro apps today, so you are ready! You will find preliminary Metro support in Oxygene for .NET as well as Data Abstract and RemObjects SDK for both .NET and JavaScript.

Free JavaScript Client Libraries

Another big annoucement is that our JavaScript client libraries are now abailable as seperate, free downloads. You can use these to freely add Metro clients to your existing Delphi, .NET or Relativity servers. Check out the video on developing Metro apps with Data Abstract for JavaScript. If Windows 8 Metro isn’t on your radar yet, you can also use the JavaScript client libraries to build browser based client applications, as well as mobile applications with tools like Titanium or PhoneGap.

Schema Modeler 7 Tech Preview

Beyond Metro and JavaScript, you will also find a Tech Preview of our Schema Modeler 7 for Windows. This new Schema Modeler has been designed from the ground up to provide a better and more streamlined schema editing experience. If you are familiar with the reinvented Schema Modeler from the Xcode edition, you will see they have a lot in common.

We’re still putting some finishing touches on DASM7 (as we call it internally), before we consider it “done”. This means DASM7 does not replace the old Schema Modeler yet. You can find it in the \Bin folder of your Data Abstract installation and give it a try — or run it with /register once to make it the default.

But Wait, There’s More!

This is just the tip of the iceberg. As always, check the change logs to see what else is new in the “Summer 2012” release.

So renew your subscriptions with our recently reduced renewal pricing, upgrade to a new platform, or download a 30-day free trial today, and get a jump on summer!

RemObjects SDK for JavaScript and Smart Mobile Studio

May 30, 2012 in Data Abstract, Delphi, JavaScript

Recently, Smart Mobile Studio 1.0 was released and some of our customers expressed an interest in using it with our RemObjects SDK for JavaScript, so I gave it a try. For those of you who don’t know anything about it: Smart Mobile Studio lets you write Object Pascal code (based on the Delphi language) to build a JavaScript application.

You can download the trial version, install and run it. The IDE itself looks cute, its welcome screen offers quite a lot of starter info and we can start creating new projects immediately. Of course the first thing to do is to connect to the RemObjects MegaDemo server with the JavaScript libraries…

Adding RemObjects SDK files

I’ve found two ways of doing this:

Copy the library files to the project folder and manually add the following HTML at the end of the <head> section of index.html.

<script type="text/javascript" src="RemObjectsSDK.js"></script>
<script type="text/javascript" src="MegaDemoLibrary_intf.js"></script>

Or just add press “add script” and paste the script text there.

Designing the form

We’re going to create our usual Sum test app, so let’s create a form like this:

The code

Skipping research attempts, here’s what I got:

procedure TForm1.OnSuccess(res: variant);
    W3EditBox3.Text := res;
procedure TForm1.btnClick(sender: tobject);
var svc: variant;
    @svc = new MegaDemoService(new RemObjects.SDK.HTTPClientChannel('http://localhost:8099/json'),
    new RemObjects.SDK.JSONMessage());
  svc.Sum(W3EditBox1.Text, W3EditBox2.Text, @self.OnSuccess);
Procedure TForm1.InitializeObject;
  {$I 'Form1:impl'}
  W3Button1.OnClick := btnClick;

And that was enough to get the answer.


It’s quite easy to use RemObjects SDK for JavaScript as a third-party library with a quick asm section hack. The blog post of the Smart Mobile Studio creator shows that this may be done properly, and we’ll look into providing official and deeper integration with SmartStudio along those lines in the future.


Migrating from DataSnap to Data Abstract

May 23, 2012 in Data Abstract, Delphi

Customers frequently ask us how to migrate from their legacy system to take full advantage of the advanced features in Data Abstract. Eugeny just finished a wiki article covering the ever popular move from DataSnap to Data Abstract. There is even a test case with source code to download. So pull out your legacy DataSnap applications and give them the upgrade you need so you can take advantage of all the great features of Data Abstract. I think you’ll be surprised how easy the migration can be, and happy you made the move!

Read the rest of this entry →

Windows 8? We got you covered!

April 17, 2012 in .NET, Delphi, Elements, JavaScript, Metro, Month of Metro, Visual Studio, Windows

I updated this slide from //Build/Windows 2011 to show where you can use RemObjects Software’s tools with the Windows 8 Platform and Tools.

Naturally, you can continue to use our tools for Delphi and .NET for desktop application development with Oxygene for .NET, Data Abstract and RemObjects SDK. If you are using Hydra, you can even combine Managed .NET and Unmanaged Delphi for the best of both worlds.  Then, with our latest JavaScript client libraries, we also have you covered in the browser.

The part that everyone is interested in is the new Metro style apps. These are the apps designed for touch on tablets and the desktop, and running in the Metro area of Windows 8. Most importantly, Metro style apps are the only ones available through the Windows Store. We got you covered for Metro, too. The latest betas of our .NET editions work with C#, VB and Oxygene for .NET to build XAML based Metro User Interfaces. Thanks to Windows 8’s new support for JavaScript based Metro apps, you can use our JavaScript client libraries for Data Abstract and RemObjects SDK to build Metro apps based on JavaScript and HTML/CSS too.

We are not in the unmanaged Metro space yet. Currently, the only tools that are supported there are Visual C and C++, which we don’t have libraries for. Hopefully in the future we will see that gap filled in one way or another.

One important thing to point out about the JavaScript client libraries is that they ship with all editions, including our Delphi editions. That means if you currently are building solutions with DA/Delphi or RO/Delphi, you can add JavaScript Metro client applications to your solution, all with the RemObjects licenses you have today. We will soon be offering DA/JavaScript as a free separate download too.

Currently, Metro support is only available in our beta builds (which are available to all users with current subscriptions). Rest assured that we will have final versions of our Metro support by the time Windows 8 ships.

Profile photo of marc

by marc

Choosing the Best Toolchain for each Platform

February 4, 2012 in .NET, Android, ASP.NET, Cocoa, Data Abstract, Delphi, Elements, iOS, Java, JavaScript, Mac, Metro, Mono, MonoTouch, non-tech, Oxygene, Platforms, RemObjects, Visual Studio, Windows, Windows Phone, Xcode

Four or five years ago, the software world was simple: if you were a commercial software developer, you were developing for Windows. But this has changed drastically with the advent of mobile platforms such as iOS and Android, the steadily increasing market share of Macs, and the establishment of new development paradigms such as rich web applications hosted in browsers.

Here at RemObjects, I field the majority of so called “sales related” emails (that is, emails that aren’t technical support requests handled by our excellent support team and the product developers) myself — and as this century gets older, I see more and more requests asking what tools and toolchains to pick for different platforms. “Can I develop for both Windows Phone 7 and Android with Oxygene and share code?” — “Which version of Data Abstract is best for targeting iOS?” — “Should I use Oxygene for .NET with MonoDroid or Oxygene for Java for my Android app?”.

There are a lot of great development tool chains for the different platforms out there — be they Xcode/Cocoa, Visual Studio/.NET, Delphi, JavaScript — and sometimes the decision does not seem easy, because here at RemObjects we provide editions of most of our products for various development platforms, and often more than one choice can be applied to a specific platform need.

To help make heads and tails of this, we created a small graphical overview chart on our website that gives insight into which language/framework/product combinations we support on any given platform and — more importantly IMHO — which combination we recommend.*

[*And that recommendation might not always be what you think — for example, I often get looked at weirdly when I recommend Xcode over our own Oxygene (plus Mono) for Mac development. But development tools, even versatile ones such as Oxygene, or Delphi, or Visual Studio, are not and should not be Jacks of all Trades, and thus no single tool, no matter how great (and we happen to think Oxygene is pretty great ;) can be the best choice for all scenarios. We acknowledge and honor that.]

You can find this overview matrix — which will be ever-expanding as time goes by and the development world around us changes — at; i’m also including a static screenshot of it, below.

May it help you to choose the best set of tools for your needs!