Export functions from system verilog to C that uses persistent object

I need to export some functions to C through DPI, the skeleton code loos like follows:
// SV Source

class host_flow extends uvm_sequence;
`uvm_object_utils(host_flow )
int fw_in[`IN_ARRY_LEN];
int fw_out[`OUT_ARRY_LEN];
function new (string name = "fw_flow_seq");
super.new(name);
endfunction : new
extern task body();
endclass
//---------------------------------------------------------------------------------------------
// body()
//---------------------------------------------------------------------------------------------
//task fw_flow_seq::init();
task fw_flow_seq::body();
bit [31:0] addr,addr1,data1;
bit [31:0] data[4];
logic [31:0] data2[];

while(tb_terminate) begin
cnt = cnt +1;
//wait_for_interrupt();
addr = 'h00005678;
hw_mem_read(addr, 0, data2,`IN_ARRY_LEN); //fetch data from FPGA HW
foreach(data2[i]) begin fw_in[i] = data2[i]; end
temp = tb_process(fw_in); //SV -- > C call
end //while(tb_terminate....
endtask

//C code

#define DPI_DBGX2(x,y) fprintf(stderr, "\nDPI->C %s:%d %s=%x ~~ %s=%x \n",__FUNCTION__,__LINE__,#x,x,#y,y)
int tb_process(void *input)
{
 DPI_DBG2(input,output);
 int write_size,read_size;
 int data[1024];
 while(input)
 {
   hw_mem_read(input_decoded_addr,data,size); //C-->SV call
   //process data
   hw_mem_write(addr,data,size); //C-->SV call
   hw_reg_write(reg_addr,0x1);   //C-->SV call
 }
return 0;
}

Issues:

  1. implementation hw_* routines involves some persistent objects(e.g. sequencer) that are instantiated only once, and used for every call
    how do I put the code(instantiates a sequencet) in a module that is only run once, and keep the object handles?
  2. Do I need to export the routines as tasks or functions, what is the difference?
  3. Do I need to create a separate module for the purpose of export the routines?

Thanks