[Mono-list] Delphi and Mono

Jonathan Pryor jonpryor@vt.edu
Sun, 02 May 2004 17:04:40 -0400


On Sat, 2004-05-01 at 08:20, Vikram Bharwada wrote:
> Hi,
> - I have code written in Delphi 7 which i plan to migrate to Delphi 8.NET
> - After migrating i intend that my application also runs on Linux/Unix using
> Mono.
> - Is this possible as of today, or should i migrate from Delphi 7 to C#.NET
> instead of
> Delphi 8.

Is this possible?  Maybe.

In theory, Mono should be able to run .NET programs.  In practice, this
depends on how the language is implemented, and what the library
dependencies are.

For example, Managed C++ can't run under Mono, as the Managed C++
compiler by default emits mixed mode assemblies, which contain both
managed and unmanaged code.  (cl.exe can be given flags to permit fully
managed code generation;  see the FAQ for details.  cl.exe *cannot*
generate "safe" IL code, so it cannot currently be used when the managed
code needs to run in a secure environment.  VS 2005 will change this.) 
Mono can't handle mixed-mode assemblies, nor the unmanaged code they

C# and Visual Basic.NET are both fully managed, but the use of
assemblies that are not themselves fully managed complicates the
situation.  For example, if the code uses P/Invoke to use native Win32
functions, it may not work on Mono (and probably won't, at least until
System.Windows.Forms is implemented on top of Wine, and even then
compatibility will only be as good as what Wine provides).

Which brings us to Delphi.  I know nothing about Delphi, and answers to
the following questions will influence Delphi compatibility.

  - Does the Delphi compiler emit fully unmanaged code?  Mono doesn't 
    support mixed-mode assemblies.
  - Does it depend upon any external libraries?  (For example, Visual
    Basic.NET code often depends on the Microsoft.VisualBasic.dll
    assembly, which needed to be re-implemented by Mono before VB.NET
    code could run without change.)
  - Do any of these required external libraries depend on native code?
    Native code dependencies will either require that the vendor 
    (Borland) explicitly support Mono, or someone would need to 
    volunteer and develop a replacement.

It may be easiest to ask Borland if they intend to support, or at least
easily permit, the execution of Delphi code on Mono.  Remember that just
because Delphi may work on Mono now doesn't mean it will in the future,
if Borland decides to change how the language and libraries are
implemented.  Letting them know that you require Mono support may
influence their actions.

 - Jon