-
Notifications
You must be signed in to change notification settings - Fork 5
Add example project #3
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
Conversation
FWIW this adds some maintenance burden so if you'd rather discard or wait, no problem! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wojtekmach thank you, I think a minimal example is helpful! We already somewhat have a project in test/, but it's not exactly the best getting started :D
I've just pushed a few adjustments to the test/ project on main, and I dropped a few comments here to make these two aligned. If you have any options about Makefile specifics, let me know!
Btw. one thing I haven't explored yet, but would be cool, is having an Igniter installer that just generates those files in an existing Mix project. That would be much more practical than copying files and renaming stuff, but that can come in the future.
example/c_src/example_nif.cpp
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
example_nif.cpp
-> example.cpp
@on_load :__on_load__ | ||
|
||
def __on_load__ do | ||
path = :filename.join(:code.priv_dir(:example), ~c"libexample") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this can also be the following, wdyt?
path = :filename.join(:code.priv_dir(:example), ~c"libexample") | |
path = Application.app_dir(:example, ["priv", "libexample"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, but according to erlang:load_nif/2
typespec the path should be a charlist, so probably safer to stick to that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🍜🐈
No description provided.