Opened 13 years ago
Last modified 13 years ago
#1663 closed defect (fixed)
pass array parameter to a external function
Reported by: | Willi Braun | Owned by: | Willi Braun |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | Version: | ||
Keywords: | Cc: | Willi Braun, Martin Sjölund, Willi Braun |
Description
pass arguments that are parameter is ok, but the second case results in "Segmentation fault".
{{{valgrind output:
==9573== Process terminating with default action of signal 11 (SIGSEGV)
==9573== Bad permissions for mapped region at address 0x45F5D0
==9573== at 0x4091BA: data_of_integer_array (integer_array.h:278)
==9573== by 0x4092CA: _ExtF2 (ExtLib_functions.c:40)
==9573== by 0x409E4B: eqFunction_4 (ExtLib.c:555)
==9573== by 0x409F10: functionDAE (ExtLib.c:579)
==9573== by 0x42371E: update_DAEsystem (in /home/wbraun/workspace/OM/trunk/testsuite/mosfiles/ExtLib)
==9573== by 0x44051D: state_initialization(INIT_OPTI_METHOD) (in /home/wbraun/workspace/OM/trunk/testsuite/mosfiles/ExtLib)
==9573== by 0x424637: solver_main(int, char, double&, double&, double&, long&, double&, int) (in /home/wbraun/workspace/OM/trunk/testsuite/mosfiles/ExtLib)
==9573== by 0x4171EB: callSolver (in /home/wbraun/workspace/OM/trunk/testsuite/mosfiles/ExtLib)
==9573== by 0x4181D8: startNonInteractiveSimulation(int, char) (in /home/wbraun/workspace/OM/trunk/testsuite/mosfiles/ExtLib)
==9573== by 0x419B22: _main_SimulationRuntime (in /home/wbraun/workspace/OM/trunk/testsuite/mosfiles/ExtLib)
==9573== by 0x40A02F: main (ExtLib.c:655)
}}}
{{{ExtFunc.h
/* Header file for ExternalFunc1 function */
void ExtF1(int, const int*, double*);
void ExtF2(int, int*, double*);
function ExtF1
input Integer nr;
input Integer inI[nr];
output Real outR[nr];
external "C" ExtFunc1(nr, inI, outR) annotation(Library="libExtFunc.o",Include="#include \"ExtFunc.h\"");
end ExtF1;
function ExtF2
input Integer nr;
input Integer inI[nr];
output Real outR[nr];
external "C" ExtFunc2(nr, inI, outR) annotation(Library="libExtFunc.o",Include="#include \"ExtFunc.h\"");
end ExtF2;
model ExtLib
Integer[3] a0 = {1,2,3};
parameter Integer[3] a1 = {1,2,3};
Real x1[3];
Real x2[3];
equation
x1 = ExtF1(3,a1);
x2 = ExtF2(3,a0);
end ExtLib;
}}}
Fixed in r10642