Skip to content

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

Merged
merged 8 commits into from
Mar 7, 2025
Merged

Conversation

wojtekmach
Copy link
Contributor

No description provided.

@wojtekmach
Copy link
Contributor Author

FWIW this adds some maintenance burden so if you'd rather discard or wait, no problem!

Copy link
Member

@jonatanklosko jonatanklosko left a 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.

Copy link
Member

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

wojtekmach and others added 7 commits March 7, 2025 14:53
Co-authored-by: Jonatan Kłosko <jonatanklosko@gmail.com>
Co-authored-by: Jonatan Kłosko <jonatanklosko@gmail.com>
@on_load :__on_load__

def __on_load__ do
path = :filename.join(:code.priv_dir(:example), ~c"libexample")
Copy link
Contributor Author

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?

Suggested change
path = :filename.join(:code.priv_dir(:example), ~c"libexample")
path = Application.app_dir(:example, ["priv", "libexample"])

Copy link
Member

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.

Copy link
Member

@jonatanklosko jonatanklosko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🍜🐈

@jonatanklosko jonatanklosko merged commit ad18a73 into elixir-nx:main Mar 7, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants