ventgrey
2.0 node_modules directory approach breaks when using private npm packages.
I think there is already an issue that I can link to this. I've started redacting my issue though, https://github.com/denoland/deno/issues/23266
10 replies
2.0 node_modules directory approach breaks when using private npm packages.
Okay, I'll open one 🙂 I've got even more context. It seems that the underlying issue is with libraries that depend on
npm
packages that need external FFI mods, this results in the deno compile
command running correctly but not inserting the main ESM script in the final binary10 replies
Help with FFI strings
I'm already at that stage. Using text encoders to feed
Uint8Array
into the function buffer
parameters. However, this response troubles me as step 4 is still the exact same type specifically a Deno.PointerValue<unknown>
. Deno still whines about types when doing a new UnsafePointerView
. Trying to change the PointerValue from unknown
to anything else makes the type checker angry as well.13 replies
Help with FFI strings
[CONTINUE 1]
Then I decided to see how others do it and I ended up in the Bun docs. Which has an interesting take when it comes to strings (not providing link to avoid spamming more links) but goes like this: JavaScript strings and C-like strings are different, and that complicates using strings with native libraries.
OK, so maybe a "CString" like Bun it's what I need.
I found Deno issue #14248 where a Deno release is mentioned, and there, in a codeblock an example of such method is used and it requires yer another UnsafePointerView object, neither
pointer
nor buffer
work for this approach. Which leads me to think, that nothing that returns char*
is remotely usable in the FFI and should return a uint8
instead (?)
https://docs.deno.com/api/deno/~/Deno.UnsafePointerView
Docs also go nowhere when explaining such returned types. Don't get me wrong, this is probably a 99.9% skill issue by me.
So, if returning any pointer of buffer from dylib
is the same as doing nothing. Why is the PointerValue
a returned thing if that
is supposed to return a PointerObject
? Why is that not documented? How can I help with that documentation if I manage to figure this out? Does a PointerValue
instead of a PointerObject
mean i messed up somewhere in the compiled language?
I thought this was possible in the past because some stackoverflow answers point that pointer
is old and work must be done with Uint8Array
if you want to somehow handle the function results. When was this changed? was 1.14 the only release with changes to the FFI?13 replies