Hacker News new | ask | show | jobs
Ask HN: How to made a Windows-tied library cross-platform?
4 points by mTh 6116 days ago
Our main language (Delphi) will be, most probably, cross-platform in its next version.

While writing a cross-compiler isn't a thing which interests us very much now, porting a library which was/is Windows-tied to multiple platforms, /certainly/ does.

You can think, for example at VCL (Delphi's standard library). While it was designed for Windows only, it has value in it, and, of course, there are huge codebases which depend on it.

The question is: Which would be the best approach to made an application / library cross-platform aware ensuring a smooth conversion / upgrade path (as much as possible of course)?

I stress it again, we are not interested which is the best way to do cross-platform development only (there were questions on this theme). We are interested also in yet another requirement: The old code base / installations management.

PS: Experiences and/or methodologies from similar situations with other languages (eg. C/C++) which are regarded as standard practices are welcomed.

Thanks in advance.

4 comments

In the words of the great Walter Sobchak: "you're entering a world of pain".

The best advice I can offer you is to wrap up your application's functionality into a clean library that could be made into remote services (RPC, SOAP, CORBA, COM, etc. or preferably JSON-RPC or XML-RPC) then make a a VMWare image (or similar) virtualization tool of the app and its environment. You could still use the code that way from any platform, but it's pretty much stagnant and all new improvements and extensions will either have to be made on Win32, or as external interface wrappers to augment a limited shell.

Code reuse was already hard enough, but the RAD tools and IDEs made it considerably so. You can't believe how many shops keep Visual Studio 6.0 installation just to build their projects, because later version of VS frobbed the building process and screwed up old resource files.

I dread to think of the future that awaits stuff running on the Java stack that can't be built without tools from now defunct vendors.

Nice idea. But what if we succeed to separate the GUI (which will be platform dependent) from the other code which will be total cross-platform?
Depends highly on the project type but if we're talking about a typical Delphi GUI app you don't need to be worry much if you depend on the RTL/VCL more than WINAPI itself.

I don't know about Emba.'s actual plans but what they refer to as cross-platform should be a proper port of runtime and VCL. They tried this before with Kylix but killed the project for reasons yet unknown to me (probably didn't raise much cash). So at least to have a taste of how things will work out in the future, I suggest you check out Kylix.

Embarcadero actual plans: - (theoretically) you can find on their site at embarcadero.com - but a better place to start is http://wings-of-wind.com

I do think that RTL is close if isn't already due of Kylix which you mentioned to cross-platform.

The new solution will be very different compared with Kylix. How do you envisage it?

Thanks for the link.

I don't know how they could succeed without a solution similar to Kylix. And I can't really envisage anything on the subject. Cross platform native apps is too good to be true :) (that is with third party support as abundant in Delphi, else FPC is actually there.)

What will be cross-platform in Delphi? VCL? Then rewrite everything that uses WinAPI with VCL.

Without specifics, there's no answer.

VCL first. But more generally any application. I think that a MVC approach will be the best one. Just that we need tooling to help us to do this.
Hmmm... what about tooling in the IDE which will push for MVC-type of development?