Hydra plugin inside another plugin

I have this piece of code in a library project in c#.

this.moduleManager = new RemObjects.Hydra.ModuleManager();
var Module = this.moduleManager.LoadModule("D:\\xyz\\xyz\\tmp.dll");

I get this error:

An exception of type ‘System.IO.FileLoadException’ occurred in RemObjects.Hydra.Host.dll but was not handled in user code

Additional information: Could not load unmanaged module dll (193)

The same piece of code and the .dll file that I am trying to load, works fine with the demo/sample “host” application in visual studio 2015.

N.B. this code is being used inside another library project project.

My target is to make a plugin (the library project in c#) that uses hydra to access function calls implemented in Delphi (tmp.dll).

Hello

Please create a testcase for this issue to make sure no details are missued out

Thanks in advance

I created a sample .dll project using Delphi 2007. (RemObjects Hydra -> Plugin Module).
A sample VS solution having the problem has been uploaded where i try to load that dll

WpfApplication.zip (365.9 KB)

The project you sent is not related to the issue you described. It is just a host application. Please provide full testcase that can be used to reproduce the issue.

It is related to the issue. I have just simplified the problem. This would solve the main issue also. I also added the delphi .dll project.
You can now recreate the issue using the HostApp.sln
WpfApplication.zip (1000.0 KB)

The project you provide successfully loads the provided plugin dll not thrrowing out any errors or warnings.

The same project wouldn’t work if I change the configuration from “Any CPU” to “x64”. (I mistakenly swapped it in the previous post)
Test dll.zip (1006.6 KB)

Delphi 2007 can create only x86 dll. as I understand, you are trying to load x86 plugin into x64 host…
if you want to create x64 plugin, try to use Delphi XE2+

1 Like

Your ptoject has both ‘Any CPU’ and ‘Prefer 32-bit’ options enabled. This means that the app will run in 32-bit mode and will be able to load unmabaged plugin compiled as 32-bit dll. Switching to x64 mode in the host project causes it to run in 64-bit mode where it cannot load 32-bit plugins/unmanaged dlls.This is expected behavior.

In other words bitness of plugin(s) and host app should match, otherwise host app won’t be able to load plugins.

1 Like

Thank you for your feedback. I will check and let you know as soon as possible.