-
Notifications
You must be signed in to change notification settings - Fork 89
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
How does this project work? #103
Comments
Hey, That's a lot of questions.
This project has a C interface. (This interface is This project is implemented in C++ (for Windows and Linux) and Objective-C (for MacOS). This means that to compile this project from source, you need to use a C++ or Objective-C compiler, depending that platform you are compiling for. (The
I'm not sure what you're asking for here; the README should cover most high-level things. There are 3
I would recommend trying to write/generate a JavaScript wrapper for this project directly, instead of trying to wrap nfde-rs. This is because nfde-rs is already a wrapper for this project, and having multiple wrapper layers add more dependencies (i.e. to build a JavaScript wrapper for nfde-rs, you will need a Rust compiler, on top of CMake and a C++/Objective-C compiler). I haven't checked this, but I would imagine that there are officially-supported ways to call a C library from NodeJS/Javascript, and so there is no need to go from JavaScript to Rust (which likely involves stepping through a C interface anyway). |
I was kinda getting at "how do you magically make it use the right implementation on my system?" 😊 From university classes in C++, I've seen this kind of pattern: int main() {
#ifdef WINDOWS
std::cout << "Windows!\n";
#endif
#ifdef MACOS
std::cout << "macOS!\n";
#endif
#ifdef LINUX
std::cout << "Linux!\n";
#endif
} I think that's all done in the CMakeLists.txt in this project's case? nativefiledialog-extended/src/CMakeLists.txt Lines 9 to 11 in dbd7139
For more context on my background: When I used "advanced C++" like terminal GUI libraries + HTTP stuff, etc, I used xmake since I found cmake too complicated 😂 https://xmake.io/#/getting_started |
One of the reasons I gravitated to the Rust version was because https://napi.rs/ seems so easy to wrap stuff! 😱 vs |
unrelated question about CI: |
If you want to work in C and JavaScipt you can use QuickJS which provides a means to |
Yes that's right. There's no need to keep them in the same file when the four implementations are mostly different from each other. Also, it's impossible for macOS since it has to be in Objective-C instead of C++. |
I added CircleCI at some point because GitHub Actions didn't support macOS 12, and I wanted to make sure it worked over there. Now it's redundant, since GitHub supports macOS 12. |
Thanks for your insight! The one thing about this project that seems to be a bit "nonstandard"-enough that might be worthy of putting in the wiki (judging from response in #106) is the part about how instead of I'm closing this issue since you've answered my questions. Thanks for taking time out of your day to educate me! ❤️ |
I'd be interested in learning more about how this project works. Some questions:
#ifdef WINDOWS
cascades for each platform?Why I'm curious: I'm interested in making a JavaScript wrapper around this API using https://napi.rs/ and https://github.com/btzy/nfde-rs and I was curious about some of the design decisions behind that Rust wrapper and that lead me to be curious about the design of the original library.
The text was updated successfully, but these errors were encountered: