lodicolo / csharp-wasm Goto Github PK
View Code? Open in Web Editor NEWLicense: The Unlicense
License: The Unlicense
Callback passing into native library currently does not work (currently blocking my ability to consume emscripten_fetch), minimal reproduction scenario is can be found in HelloCallback 7987aa98b8
Delegate and extern declarations:
unsafe internal delegate void HelloCallback(int result);
[DllImport("hello_callback")] unsafe extern internal static void helloCallback(int number, string str, HelloCallback callback);
Inline static method declaration and call into native code supplying the function (the inline as opposed to separate method declaration did not change the result):
static void testCallback(int result)
{
Console.WriteLine($"from C#: Received {result} from C library callback");
}
// This completely blows up with the following, the native printf() is never hit:
// System.OutOfMemoryException: Insufficient memory to continue the execution of the program.
helloCallback(123, "abc", testCallback);
Relevant stacktrace:
System.OutOfMemoryException: Insufficient memory to continue the execution of the program.
at S.P.CoreLib.Internal.Runtime.Augments.RuntimeAugments.CreateThunksHeap (http://localhost:8000/HelloCallback.wasm:wasm-function[4636]:0x2a4c30 undefined)
at S.P.CoreLib.System.Runtime.InteropServices.PInvokeMarshal.AllocateThunk (http://localhost:8000/HelloCallback.wasm:wasm-function[4634]:0x2a47a0 undefined)
at S.P.CoreLib.System.Runtime.CompilerServices.ConditionalWeakTable.2.CreateValueCallback<System..Canon.System..Canon>.InvokeOpenStaticThunk (http://localhost:8000/HelloCallback.wasm:wasm-function[4635]:0x2a4b06 undefined)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.