Edge: Calling native x86 code from .NET on node.js x64 on x64 Windows

Created on 16 Apr 2013  ·  3Comments  ·  Source: tjanczuk/edge

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?

Most helpful comment

+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.

All 3 comments

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.

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?

+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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

keyiis picture keyiis  ·  3Comments

popsugon picture popsugon  ·  3Comments

EricSmekens picture EricSmekens  ·  7Comments

sz30313484 picture sz30313484  ·  7Comments

bravomikekilo picture bravomikekilo  ·  6Comments