If the only difference between this model and a working variant is the C-script then the cause of the stuck simulation is most probably - surprise - the C-script.
Good C-scripts are hard to write and harder to debug. If there is, for example, an endless loop in your 'Start function code', PLECS will hang on model start and there is no chance to stop the simulation.
Debug your C-script, for example by adding printf in your code to verify that the end of your 'Start function code' is reached. This way you may be able to find where your C-script gets stuck.