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

Calling native x86 code from .NET on node.js x64 on x64 Windows #40

Closed
node2013 opened this issue Apr 16, 2013 · 3 comments
Closed

Calling native x86 code from .NET on node.js x64 on x64 Windows #40

node2013 opened this issue Apr 16, 2013 · 3 comments

Comments

@node2013
Copy link

Hi,

Is it possible to call native 32-bit dll from .NET code in edge.js, using node.js x64 on Windows x64?

In console .NET application I can call my old 32-bit native dll (by DllImport). But using the same code with edge.js i get BadImageException. The same result I get If I try call x86 .NET assembly.

So, I have to use x86 node.js because of using some legacy x86 components?

Another question, how about COM-s?

I saw that IIS-node uses only x86 node.js. I have no special requirements for x64 for my app (but of course x64 version would be more great on x64 machines). So I should use x86 version, shouldn't I?

@tracker1
Copy link

If it can be accessed via C (native dll), you may be interested in building a native module/package for use with node.

How complex is your interaction, and could it be exposed via a command line exe that uses piped input/output?

Just offering a couple of alternative solutions that may be more direct.

@node2013
Copy link
Author

Thank you for answer

In some cases when I have some .NET logic using native.dll, I think I could reuse all code in .NET and call it one time from JavaScript.

But in other case, when I could have JavaScript code with some logic which uses logic from native dll, it would be better if I use native code directly from JavaScript.

In C# I have two native functions imported, both with signature like as:

[DllImport("library.dll")]
static extern int Func1(byte[] p1, ref int p2, byte[] p3, int p4);

I have found node.js package for calling dll-s https://github.com/rbranson/node-ffi.
but I haven't tried it yet. How difficult is calling this kind of function with node-ffi?

I'm thinking about getting binary file from database, then decode with some algorithm in native dll, and optionally resize it and at the end return in binary output to browser. BTW anyone knows any good node.js package to process binary images in node.js?

@jlee1201
Copy link

+1 -- I am wondering if any progress has been made? My specific use case is that I would like to call a 3rd party .NET assembly that in turn references a 32-bit native C++ dll.

@agracio agracio closed this as completed Jun 5, 2024
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

4 participants