Cannot use svSetScope to call DPI-C function/task in C++

Hi Everyone,

I have a design as below picture:

I export function b and task a in sub instance top.sub0.sub1 to call in C++ code.
I call them in C++ code using svSetScope(svGetScopeFromName(“top.sub0.sub1”) but it does not work correctly. The error is as below:

    undefined reference to `a(int)
    undefined reference to `b(int)

Is my above code correct ?

BTW, in C++ code, I have function a_c to call task a and function b_c to call function b.
After that, I call them again in sv side in top.sub2 instance. Because task have Delay and @posedge inside.
When i call it, does it work well with delay ?

Thanks in advance.

It would really help to show us the actual code at text, not a picture of it.

In sub2, where are the import statements? What are the arguments a and b? You can’t have task a as an argument to a_c. Where and when does the error message appear?