Hey everyone,

I've been struggling with this problem for hours now and I have read and tried every example I could find but did not find a solution to my problem:

I have a DLL written in C#. The DLL export function calls three functions:

PrepareData(): Heavy calculations

ComputeNN(): Mild calculations

GUI(): Creates/updates GUI that uses above calculation values

So basically the DLL looks as follows:

```
[DllExport("NNExportDLL", CallingConvention = CallingConvention.StdCall)]
static double NNExportDLL([MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] double[] training_data, int training_data_size, int inputs, int outputs, int training_sets, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2)] double[] neural_input, int epochMax, int hiddenLayerNeurons, double Low_Normalize, double High_Normalize, int ShowGUI)
{
PrepareData(training_data, training_data_size, training_sets, neural_input);
ComputeNN(epochMax, hiddenLayerNeurons);
GUI();
return (NeuralOutput);
}
```

The DLL is called by an external application many times. I have coded the GUI so that at first run the GUI is created, and onwards it just gets updated. The problem is the GUI is obviously unresponsive due to the calculation functions using the threads the whole time.

I have tried many threading functions but I cannot get it to work, would appreciate it if someone could give me some advice.

Thanks!