Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interacting with an x86 DLL #242

Open
connor-ricks opened this issue Dec 31, 2024 · 3 comments
Open

Interacting with an x86 DLL #242

connor-ricks opened this issue Dec 31, 2024 · 3 comments

Comments

@connor-ricks
Copy link

connor-ricks commented Dec 31, 2024

Hello, I am trying to work with an old DLL that operates in x86.

When attempting to access the DLL I get this error...

The module was expected to contain an assembly manifest

The error is System.BadImageFormatException which I would usually attest to an x86 vs x64 conflict.

Any ideas?

Here is the code I'm using...

  var test = edge.func({
    assemblyFile: 'app/api/TestCOM/testcom.dll',
    typeName: 'TestCOM.TestCOM',
    methodName: 'GetName',
  });

  const output= test({}, true);

Thanks!
Connor

@agracio
Copy link
Owner

agracio commented Jan 1, 2025

Try using node x86.
Take a look at this line

var nativePath = path.resolve(__dirname, `native/${process.platform}/${process.arch}/${nodeVersion}`);

@connor-ricks
Copy link
Author

Dang, so there isn't a way to execute a 32bit DLL from 64bit note 😢

For various reasons (Next.JS requiring 64-bit and others) I can't downgrade to 32 bit node. I guess I'll need to figure out a different way of interacting with the DLL.

@agracio
Copy link
Owner

agracio commented Jan 1, 2025

You could create some kind of postinstall script to patch this line and force it to load ia32 dll instead.
Take a look at https://github.com/agracio/edge-js/tree/master/lib/native/win32 dir structure.
This would only work on Windows.

Start by just replacing that line in node_modules/edge-js/lib/edge.js to see if it resolves the issue.

var nativePath = path.resolve(__dirname, `native/${process.platform}/ia32/${nodeVersion}`);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants