Simplify foreign symbol imports/exports, similar to C/C++ dynamic library headers #4740
Bagellll
started this conversation in
Ideas/Requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello, let me explain what I mean in the title. Something I quite like about dynamic libraries, or even static ones, is the ease of use when it comes to library functions/methods.
Put simply, what I mean is that a macro like this is all I need for implicit imports/exports.
or this syntax for GNU
In Odin, I'm unaware if there's an equivalent. I believe it would be beneficial for one to be considered if not. I'd be willing to submit a more formal proposal or PR if that's something that sounds interesting. The way collections are at the moment, something like this would probably require another command line argument to give the compiler a notion of an "external" symbol from a collection. Mainly I'm looking for something more ergonomic than using
foreign
and redefining function signatures again.My idea of implementation would be to use the already existing
export
attribute, modify theimport
statement, and add a command line argument. The compiler would import both exported symbols and all types from the package; potentially inline functions.Suggested syntax would be something along the lines of this:
or this:
TL;DR: Suggesting implicit
foreign
functions to deal with libraries better, akin to an API macro in C/C++Beta Was this translation helpful? Give feedback.
All reactions