Pre-Sales question… I have a cSharp dll that I do not have source for and the inability to have it altered. The dll only exposes managed code in classes which need to be instantiated to use. I need to access this dll in a Delphi service application.
Is it possible to use Hydra for this? Thanks! Dennis
yes, it is possible, but you need to create a wrapper for this .dll .
see C:\Users\Public\Documents\RemObjects Samples\Hydra for Delphi\Delphi WPF\Visualizer Plugin (C#)\Wrapper.cs
for example of such wrapper.
Thanks Evgeny, I’ll download the demo and do a proof of concept for the dll.
Can you point me to some documentation that would get me started in incorporating the dll?
the wrapper.cs appears to be a csharp source file. I cannot rebuild the dll, nor do I have the source for it. Does hydra create a delphi source file for interfacing to the dll?
You need to create descendant of IHYCrossPlatformInterface that should contain required methods for your C# dll.
later you can import this interface into delphi.
see more in Passing Interfaces between Host and Plugins article.
So Hydra will not generate a file based on the dll I need to use? I do not have the classes or method specifications to write that. For some reason, I was under the impression that hydra would read the dll and generate a file I could use in my project.
the same sample (Delphi WPF
). Hydra wizard in Delphi IDE creates this file after importing .NET assembly:
unit Visualizer_Import;
{ This unit has been automatically created by Hydra. Any changes in this unit might be lost in automatic updates }
interface
uses
uHYCrossPlatformInterfaces;
type
IVisualizerControl = interface;
// Original Name: Visualizer.IVisualizerControl
IVisualizerControl = interface(IHYCrossPlatformInterface)
['{8032a51c-5961-41f5-9582-c77d98ea4d93}']
function get_BarsVisible: WordBool; safecall;
procedure set_BarsVisible(const value: WordBool); safecall;
procedure Randomize; safecall;
procedure Sinus(const aRange: Double); safecall;
property BarsVisible: WordBool read get_BarsVisible write set_BarsVisible;
end;
implementation
end.
so you don’t need to manually create it.
Where is the importer tool located? I created the host, plug module and
a non-visual plugin, but can’t seem to find where to import my dll from.
I odn’t see that menu item between tools and window on the main menu. Is there something I need to do to make it visible?
I’m getting an exception when XE2 fires up. “625 value cannot be assigned to property width of object RemObjects.Everwood.Live.LoginForm. Overflow or underflow in the arithemetic operation”
sorry, old screen.
Hydra
menu is put now under Tools
,so
Delphi IDE->Tools->Hydra->Import Interfaces from .Net Assemblies
menu item
Ahaa… found the hydra menu, but the only menu Item I have is “Hydra package settings”
this menu item is shown only if Hydra for .NET
is installed into VS2008+
So how do I import a cSharp dll to use in delphi xe2?
have you selected Visual Studio integration when you installed Hydra?
I don’t recall seeing that, but probably not since VS is not installed on my machine.
what’s your screen settings (namely DPI/scaling) and Windows version ?
that wizard is part of Hydra for .NET and looks like it isn’t installed …