Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Allow users to choose between safe/unsafe/both #94

Open
edsko opened this issue Aug 15, 2024 · 3 comments
Open

Allow users to choose between safe/unsafe/both #94

edsko opened this issue Aug 15, 2024 · 3 comments

Comments

@edsko
Copy link
Collaborator

edsko commented Aug 15, 2024

The choice between safe and unsafe is not really something the tool can make on behalf of the user, though in the absence of any configuration, safe should be the default. There are also examples where we want to make two bindings (one safe and one unsafe) to the same C function; for example, see cryptohash (where the choice between the two is based on input size, though this is of course not directly relevant to hs-bindgen).

@edsko
Copy link
Collaborator Author

edsko commented Aug 28, 2024

One option here might be to follow the Vulkan bindings, and generate two modules .Safe and .Unsafe, so that programmers can just import the module they want. (Somewhat related: #75).

@phadej
Copy link
Collaborator

phadej commented Aug 28, 2024

One option here might be to follow the Vulkan bindings, and generate two modules .Safe and .Unsafe

That will be terrible for interfaces with structs.

@edsko
Copy link
Collaborator Author

edsko commented Aug 29, 2024

Yes, this will certainly not be a good option in all cases.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants