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

Adaptive progress #1

Open
jinzhongjia opened this issue Jan 17, 2024 · 12 comments · May be fixed by #2
Open

Adaptive progress #1

jinzhongjia opened this issue Jan 17, 2024 · 12 comments · May be fixed by #2
Assignees
Labels
enhancement New feature or request

Comments

@jinzhongjia
Copy link

I started working on bunjs adaptation

@jinzhongjia jinzhongjia added the enhancement New feature or request label Jan 17, 2024
@jinzhongjia jinzhongjia self-assigned this Jan 17, 2024
@jinzhongjia
Copy link
Author

In fact, library adaptation is easy
I've looked at the deno-webui source code and I don't think the way to download and unzip the webui library is elegant enough
I was thinking how can I introduce dynamic libraries in a more elegant way

@jinzhongjia jinzhongjia linked a pull request Jan 17, 2024 that will close this issue
Draft
@AlbertShown
Copy link

@7flash provided webui-dev/deno-webui#39
This solves the issue of missing dynamic libs in the compiled version deno --compile
If you think this approach is better, then let's use it in both Deno and Bun.

@jinzhongjia
Copy link
Author

@7flash provided webui-dev/deno-webui#39 This solves the issue of missing dynamic libs in the compiled version deno --compile If you think this approach is better, then let's use it in both Deno and Bun.

ok, thx

@jinzhongjia
Copy link
Author

the implementation, which embedded the library as json in the compilation result and then unzipped it at run time, which slows down startup time, especially on windows

@jinzhongjia
Copy link
Author

bunjs natively supports embedded files, and I'm looking for ways to load embedded dynamic link libraries directly

@AlbertShown
Copy link

In this case, Bun may use a different method than Deno, which is fine.

@jinzhongjia
Copy link
Author

jinzhongjia commented Jan 17, 2024

However, there is another problem. The ffi function provided by bun can only read the data pointed to by the c pointer according to the number of bytes offset, but the webui uses the size_t type, which seems to be different in different platforms

@jinzhongjia
Copy link
Author

jinzhongjia commented Jan 17, 2024

I'm not sure it must be 8 bytes in size when it's in a 64-bit library (bunjs only supports 64bits system)
The copilot said it depends on the compiler

At least I used gcc to test, which treats size_t as 8 bytes

@jinzhongjia
Copy link
Author

bunjs can't load dynamic link libraries directly from memory, so maybe we should offer two alternatives:

  1. Download the dynamic link library to the user directory when the program is running
  2. The program itself is embedded in the dynamic link library, which is directly released to the user directory during runtime

@sensiblearts
Copy link

Could this announcement make it easier?: https://bun.sh/blog/compile-and-run-c-in-js

@jinzhongjia
Copy link
Author

I'll try it later, it seems to work

@sensiblearts
Copy link

@jinzhongjia , if you would like help with this, feel free to ask me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants