Re: D DLL crashes if not run on the main thread

2023-09-05 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
Assuming it works outside of a DLL, you're probably missing the runtime initialization calls. Mix SimpleDllMain in (or do your own). https://github.com/dlang/dmd/blob/9639d72ea0883808feff7aba71d87c5a78fb7f92/druntime/src/core/sys/windows/dll.d#L577

Re: D DLL crashes if not run on the main thread

2023-09-05 Thread raven09 via Digitalmars-d-learn
On Tuesday, 5 September 2023 at 22:53:35 UTC, Richard (Rikki) Andrew Cattermole wrote: Whatever is going on, that function you showed would not call into druntime. So I don't think it's related. As of right now I have no tips as I'm tired, but I suspect its on the .net end. Sorry for the con

Re: D DLL crashes if not run on the main thread

2023-09-05 Thread Guillaume Piolat via Digitalmars-d-learn
On Tuesday, 5 September 2023 at 22:45:28 UTC, raven09 wrote: I *assume* that this has something to do with D's GC? But I tried calling GC.disable() and nothing changed. Any help or insight would be appreciated. Thanks in advance If you want to have a D DLL called from elsewhere, and don't

Re: D DLL crashes if not run on the main thread

2023-09-05 Thread Hipreme via Digitalmars-d-learn
On Tuesday, 5 September 2023 at 22:45:28 UTC, raven09 wrote: Hi, I've compiled a DLL using D and intended to use it with a C# winforms app using P/Invoke. Everything works wonderfully as long as it is called from the main thread (at least I assume that it not being on the main thread is causin

Re: D DLL crashes if not run on the main thread

2023-09-05 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
Whatever is going on, that function you showed would not call into druntime. So I don't think it's related. As of right now I have no tips as I'm tired, but I suspect its on the .net end.

D DLL crashes if not run on the main thread

2023-09-05 Thread raven09 via Digitalmars-d-learn
Hi, I've compiled a DLL using D and intended to use it with a C# winforms app using P/Invoke. Everything works wonderfully as long as it is called from the main thread (at least I assume that it not being on the main thread is causing the issues). If I start a new thread and try using any func