zhangyuang / node-ffi-rs

Implement ffi in Node.js by Rust and NAPI
MIT License
189 stars 7 forks source link

[question] Display C++ code logs to stdout #61

Closed tudor33sud closed 4 months ago

tudor33sud commented 4 months ago

Current ffi-rs version

1.0.86

Current Node.js arch

x64 win32

Descibe your problem in detail

Hi there, I'm a user of previous ffi-napi, and I'm trying to port code to ffi-rs due to builds not going through on node >=18 now on linux. I was able to run my DLL functions as expected using the current documentation, however we are depending for our debugging on the process output and we save that for each run. With the new ffi-rs package, I don't see dll console outputs anymore. Is there any way to enable that?

What's your expect result

I would like to display logs to stdout

zhangyuang commented 4 months ago

How do you print logs in your code?

tudor33sud commented 4 months ago

I only have access to the DLL test file, and I guess it uses some cout calls or something similar. The thing was, that with ffi-napi, just by using dll[method], while the function was running I could see the output.

   const dll = ffi.Library('static/executables/XServiceWrapper.dll', {
        'Init': ['int', ['string']],
        'Run': ['int', ['string']]
    });
    const initResponse = dll.Init(initInputString);

Here's a snippet to get an idea of how the code looked like to run a function which displayed dll method logs as well.

tudor33sud commented 4 months ago

OMG I am so sorry.. I got confused by logs actually. It looks like the ffi-rs also displays the logs properly. Pardon me for disturbing, I'll close the issue.