Skip to content
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

FFI possibilities #57

Closed
TomasHubelbauer opened this issue Feb 19, 2020 · 6 comments
Closed

FFI possibilities #57

TomasHubelbauer opened this issue Feb 19, 2020 · 6 comments

Comments

@TomasHubelbauer
Copy link

@TomasHubelbauer TomasHubelbauer commented Feb 19, 2020

Hi, I wonder if now or eventually Nectar could be used in the following way:

I defined a piece of JavaScript which depends on a platform API:

MessageBoxW(null, 'Hello, World!', 'Hi!', 0);

Then I somehow defined the FFI information so that Nectar knows this function I'm invoking is a part of the platform's/target's API.

And then I compile this code using Nectar and have a binary which invokes the Windows API MessageBoxW.

Also, this might be a better fit for a separate issue, but anyway: I see you are providing people with keys to access Nectar while it's in alpha and also this repo doesn't include any source code. How are you going to provide Nectar when it makes out of alpha? Is it going to be open source? Free or paid?

@adrien-thierry

This comment has been minimized.

Copy link
Contributor

@adrien-thierry adrien-thierry commented Feb 19, 2020

Hi @TomasHubelbauer ,

We are refactoring everything, adding multi compilers cross platforms options, that's why there is no source code right now

The core src code for compilers will be open source, i will add everything in the next days

We actually use kind of FFI to be able to use existing libs, like arduino's etc

Don't hesitate to join us on Discord

@adrien-thierry

This comment has been minimized.

Copy link
Contributor

@adrien-thierry adrien-thierry commented Mar 10, 2020

Hi @TomasHubelbauer ,

FFI added in last push

There is a test nectar_modules with an ffi include test from cpp

@TomasHubelbauer

This comment has been minimized.

Copy link
Author

@TomasHubelbauer TomasHubelbauer commented Mar 10, 2020

Awesome, thanks for the example!

@adrien-thierry

This comment has been minimized.

Copy link
Contributor

@adrien-thierry adrien-thierry commented Mar 10, 2020

I updated the njs lib to don't disturb windows lib

the test module now show a message box

@TomasHubelbauer

This comment has been minimized.

Copy link
Author

@TomasHubelbauer TomasHubelbauer commented Mar 10, 2020

Even better, the current form of the example is exactly what I had in mind. :-)

@adrien-thierry

This comment has been minimized.

Copy link
Contributor

@adrien-thierry adrien-thierry commented Mar 11, 2020

I add a more complete example with two functions, one simple FFI function without parameters, and one other with parameter and function loading in an object

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.