Problems with array elements as parameter in c++ function used via call_external [message #64856] |
Thu, 22 January 2009 00:54 |
Andreas Bjärkmar
Messages: 3 Registered: January 2009
|
Junior Member |
|
|
Hi!
I have run into a strange problem when using a c++ (compiled as extern
"C") dll. The problem rises when I'm calling a method to an object
I've created. When testing the parameters are in a valid range th c-
program throughs an error.
The calling in IDL looks like:
res = CALL_EXTERNAL('C:\Workspace\libmydll.dll', 'GraphCut'$
, edge_values ,T_Weights, no_of_elem, flow, labels, edges,
no_of_nodes, no_of_edges, $
VALUE=[0,0,1,0,0,0,1,1], /CDECL)
The c++ calling looks like:
g -> add_edge(edges[0], edges[1],edges[2],edges[3]);
*flow = edges[0];
and the error occurs somewhere at:
template <typename captype, typename tcaptype, typename flowtype>
inline void Graph<captype,tcaptype,flowtype>::add_edge(node_id _i,
node_id _j, captype cap, captype rev_cap)
{
assert(_i >= 0 && _i < node_num); //<-------This line
assert(_j >= 0 && _j < node_num); //<-------Or this line
...}
The strange thing is that flow that is given a value from the array
holds a value that is valid and if I send the values one-by-one by
value it works fine.
Regards, Andreas Bjärkmar
|
|
|