How to export the dpi function between c and sv

In reply to zz8318:

In reply to dave_59:
Hi Dave,
The run task in your code is invoked in the top module. Shall I know the reason ?

I’m giving you a minimal complete example that you can try yourself. You need to do the same, otherwise no one can help you.