javi
javi
DDeno
Created by javi on 10/19/2024 in #help
Sloppy imports on remote?
Is there any way to enable sloppy imports for the own imports on a remote (such as GitHub?). Trying to use some node code on deno, yet imports cannot be resolved since they're missing the extension.
error: Module not found "https://raw.githubusercontent.com/drips-network/app/fcad99122daed83e29ebb6f2637b3c67aee17a04/src/lib/components/stepper/types".
at https://raw.githubusercontent.com/drips-network/app/fcad99122daed83e29ebb6f2637b3c67aee17a04/src/lib/flows/create-drip-list-flow/create-drip-list-flow.ts:1:26
error: Module not found "https://raw.githubusercontent.com/drips-network/app/fcad99122daed83e29ebb6f2637b3c67aee17a04/src/lib/components/stepper/types".
at https://raw.githubusercontent.com/drips-network/app/fcad99122daed83e29ebb6f2637b3c67aee17a04/src/lib/flows/create-drip-list-flow/create-drip-list-flow.ts:1:26
2 replies
DDeno
Created by javi on 2/24/2023 in #help
FFI Difference between buffer and pointer
I’ve been using interchangeably Deno.UnsafePointer.of(new Uint8Array()) with type pointer and new Uint8Array() with type buffer. Is there any major difference? Per se I don’t use char[] arrays, just pointers.
5 replies
DDeno
Created by javi on 1/17/2023 in #help
Update value by reference without duplicating the data
Im exploring the world of FFI, porting some C applications I have to TypeScript, with the help of Deno. Currently, I cannot think of an efficient way to update the value that a pointer is pointing to. For instance, in C I could do something like:
char **array = calloc(2, sizeof(char*));
if (array == NULL) return 1;
*(array) = "hello";
*(array + 1) = "world";
char **array = calloc(2, sizeof(char*));
if (array == NULL) return 1;
*(array) = "hello";
*(array + 1) = "world";
Nonetheless, with Deno I have to first either allocate memory with an allocator or create a TypedArray myself, then create a new unsafe pointer of that. To update it, I’d have to create an unsafe pointer view of that pointer, get the array buffer, create a new Uint8Array from that array buffer, use the <Uint8Array>.set function to update the chunk of memory, and then create a new unsafe pointer of that, duplicating the memory and adding extra complexity. Is there another way to do it? Thanks!
4 replies