Hydra and static linking

Hello,

our build servers still compile our applications with runtime packages. But because of the debugger issues with runtime packages and the new dll loading mechanism in Windows 10, we have started to build our application on development machines without runtime packages. This makes a huge difference for debugging purposes.

Today by chance I opened the ‘Hydra Project Package Settings’ and the following line caught my attention:

“Hydra Applications need to be built with Packages”.

What is the reason for this? So far statically compiling Hydra into our app has been working fine for us.

Thank you!

Hi,

Hydra should be built with runtime packages only if you pass Delphi objects (i.e. descendants of TObject), etc between host and plugins.

If you don’t need to pass Delphi objects, host and plugins can be built w/o runtime packages.

in this case, VCL plugins should export only HYGetCrossPlatformModule method and not HYGetModuleController name name_HYGetModuleController method.

FMX plugins should export both functions in any way

exports
  HYGetCrossPlatformModule,
  HYGetCrossPlatformModule name name_HYFMGetModuleController;

Thanks for the info!

We actually use plenty of Delphi Objects that inherit from THYFakeIDispatch and implement IHYCrossPlatformInterface.

So far we have not noticed any problems. What type of problems should we then expect when statically linking Hydra and passing Delphi objects between C# and Delphi?

Thanks!

you will catch problems only if delphi objects are passed as is in interfaces like

IMyInterface = interface(...)
..
   procedure test(param1: TStringList);  // << delphi object is used here
end;

if objects are passed as interfaces, like

IMyInterface = interface(...)
..
   procedure test(param1: ISecondInterface);
end;

it will work w/o any issues.
ofc, ISecondInterface also shouldn’t use delphi objects as parameters.

That is something we do not do.
So we are safe with static linking. :slight_smile:

Just for curiosity what type of problem would you encounter in such a case, would it be a compile time or runtime error?

Thanks!

this is runtime error.

//SAssignError = 'Cannot assign a %s to a %s';

procedure TPersistent.AssignError(Source: TPersistent);
..
  raise EConvertError.CreateResFmt(@SAssignError, [SourceName, ClassName]);
end;

for IMyInterface interface, it will be Cannot assign a TStringList to a TStringList