how to connect .cpp file with systemverilog

Status
Not open for further replies.

hirenpatel

Newbie level 5
Joined
Sep 19, 2013
Messages
9
Helped
1
Reputation
2
Reaction score
1
Trophy points
3
Location
Ahmedabad
Activity points
43
how to connect .cpp file with systemverilog(Using DPI)

I am trying to connect .cpp file with systemverilog file( USING DPI ) but i got an fatal error while running my code

fatal error like : Null foreign function pointer encountered when calling 'fib_oa'

When i take .c file instead of .cpp file it runs completely and i got output

Is there any new connection require for .cpp file????????

My cpp file and sv file are below

.CPP FILE::

#include "svdpi.h"
#include "stdio.h"
#include "svdpi_src.h"
#include "stdarg.h"

void fib_oa(const svOpenArrayHandle data)
{

int i=0;
char *str1,*str2;
str1=*(char **)svGetArrElemPtr1(data,i);
str2=*(char **)svGetArrElemPtr1(data,i+1);
printf(" string str1=%s\n string str2=%s\n",str1,str2);
}

SV FILE ::

import "DPI-C" function void fib_oa(input string data[]);

program automatic testt;

string d[20];
int i;

initial begin
d[0]="ABCD";
d[1]="WXYZ";

fib_oa(d);

end
endprogram
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…