Using DLR from Unmanaged Code
Asked Answered
M

6

5

Is it possible to call managed code, specifically IronRuby or IronPython from unamanaged code such as C++ or Delphi?

For example, we have an application written in Delphi that is being moved to C#.NET We'd like to provide Ruby or Python scripting in our new application to replace VBSCRIPT. However, we would need to provide Ruby/Python scripting in the old Delphi application. Is it possible to use the managed dlls provided by IronRuby/IronPython from Delphi code?

Maebashi answered 16/9, 2008 at 16:44 Comment(0)
I
8

Yes. Delphi for Win32 example here: http://interop.managed-vcl.com/
Shows how to use a C# as well as a Delphi.NET assembly from Delphi for Win32.

Indene answered 16/9, 2008 at 16:51 Comment(0)
R
6

It is possible to host the CLR or DLR in unmanaged code as it is a COM component. From that point you can load the managed assemblies you need to interact with.

From MSDN: Hosting the Common Language Runtime

Reamy answered 16/9, 2008 at 16:50 Comment(0)
M
3

Why not embed CPython instead, which has an API intended to be used directly from C/C++. You lose the multiple language advantage but probably gain simplicity.

Marou answered 1/6, 2009 at 13:0 Comment(0)
Z
2

Yes. That is possible using Com Callable Wrappers. Basically you are enabling your .Net classes to be called through COM/ActiveX from your win32 code (Delphi or C++).

Zoa answered 16/9, 2008 at 16:48 Comment(0)
J
2

I use Unmanaged Exports to created interface to IronPython script engine in C#. Be carefull when you use .NET code from Win32 Delphi - you have to use Set8087CW($133F); to change floating point exception behavior.

Johnstone answered 28/2, 2010 at 13:12 Comment(0)
O
0

Have you seen Hydra from RemObjects? I have no experience with it, but from the intro, it looks relevant.

Octillion answered 16/9, 2008 at 18:9 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.