rossjones / nifty

helpful tools for when I need to create an Elixir NIF .
Other
28 stars 2 forks source link

Fix lib issues and restructure project #2

Closed asaaki closed 9 years ago

asaaki commented 9 years ago

Sorry, I have to propose further changes, but the gen task was not completely working for me.


Changes:

*) The NIF Elixir file will be created under lib/<name>/nif.ex to meet the general structure of a project. At least it makes more sense somehow from my POV.

**) As you can see, I reduce the path from priv/lib/lib_<file> to priv/lib_<file>. I think this is totally fine IMHO. Mostly this avoids confusion or even loading issues (one level less to care about).

***) I would say it is considerably safer to let it crash instead of returning just a string here, especially in cases where the expected return type is a string, too. This could lead to hard to debug situations, therefore the exit with the given reason points to the real issue much quicker.


I hope you like this proposal. So far this is the state where it does not fail anymore when I create the NIF stubs for a project.

rossjones commented 9 years ago

Thanks, I really appreciate you taking the time to clean this up. I need to work out building on Windows next, so it helps to have it in a much better state.

asaaki commented 9 years ago

Yeah, regarding Windows support I have to rely totally on your feedback, because I just can work on Linux and Mac OSX. But I hope these changes do not break anything. :fingercrossed:

asaaki commented 9 years ago

And thank you for this awesome tool, this saves a lot of time when playing around with C libraries! :bow: