parapluu / nifty

Erlang NIF Wrapper Generator
http://parapluu.github.io/nifty/
Other
142 stars 29 forks source link

fixed a bug on starting remote server have no path at all #64

Open eminarcissus opened 7 years ago

eminarcissus commented 7 years ago

I think this is a bug here, the process should like this. 1.fire up a remote node for nif function calling by calling a Anonymous fun, 2.It start to receive Path and fix the path 3.fire slave_listen for incoming rpc call.

The process is okay,but the first step, when firing up the child process, child process doesn't have any path info, and the anonymous function is being wrapped in nifty_remotecall module, and then when start firing up the child server, child server crashes here, it won't have any information about the module at the time.

I've used erl_eval to wrap the anonymous func now(which replaced slave_listen/0, and then exposed slave_listen/1 to the outside, now the remote part works like expected.

Really appreciate for this lib, it really helps me a lot on generating nif codes, but still, can we improve the code quality which it generated by the template? I'm seeing a lot of blanks in generated c file, which is really annoying for error detect here.

Thx for your hard work, hope it can become better in the near future ;)

kostis commented 7 years ago

Thanks for your pull request and your patience in waiting for a reaction from us.

I think this is a bug here, ... SNIP

We discussed this PR this morning and we do not really understand the issue. It would very much help, if you can add some test that shows the current (erroneous/buggy) behavior you get and the correct behavior when applying this PR. Besides helping us to understand the issue better, such a test will also ensure that the functionality does not get broken after some changes.

Really appreciate for this lib, it really helps me a lot on generating nif codes, but still, can we improve the code quality which it generated by the template? I'm seeing a lot of blanks in generated c file, which is really annoying for error detect here.

We are aware of this issue. What we do is to to use indent or astyle in the generated code. Currently, this needs to happen manually by the programmer because these programs often are not present and we do not really want to add them as (mandatory) dependencies. We will investigate how they can be automatically called if they are already installed and present in the $PATH.