Errors when passing arrays to C function via ctypes

Joined
Nov 25, 2008
Messages
1
Reaction score
0
Hello all,

I am trying to integrate a C libary (well, a C API to a C++ library) and I am getting an error when passing arrays to the C function.

I have a C function defined as:
C_API const char* myfunc(const char* ccy, const int days[], const int n_days,const double dfs[], const int n_dfs, const int anchor_date, const char* dycnt);

and I define the arrays days[] and dfs[] as:

d = c_int * 10
r = c_double * 10
days = d(1,2,3,4,5,6,7,8,9,10)
dfs = r(1.0, 2.0, 3.0,4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0)

and the error I get is :
WindowsError: exception code 0xe06d7363

The function I should mention works fine from C.

Also, I have another function defined as:

C_API const char* myfunc2(const char* type, int n_factors, const double** data, const int n_rows, const int n_cols);

and if I pass one of the single dimension arrays from above for the data variable, I get the following error:

WindowsError: exception: access violation reading 0x00000001

Any help would be greatly appreciated.

Thanks,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,900
Latest member
Nell636132

Latest Threads

Top