Skip to content
This repository was archived by the owner on May 18, 2019. It is now read-only.

Commit 683050e

Browse files
david-polakOpenModelica-Hudson
authored andcommitted
Fix FMU hybrj_ function signature
3rdParty/CMinpack/hybrj_.c has void return value, FMU export uses int. EMCC linking and WebAssembly runtime errors out on incorrect function signature. Belonging to [master]: - #2806
1 parent 0ef03fc commit 683050e

2 files changed

Lines changed: 3 additions & 5 deletions

File tree

SimulationRuntime/c/simulation/solver/nonlinearSolverHybrd.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ struct dataAndSys {
5656
int sysNumber;
5757
};
5858

59-
static int wrapper_fvec_hybrj(const integer* n, const double* x, double* f, double* fjac, const integer* ldjac, const integer* iflag, void* data);
59+
static void wrapper_fvec_hybrj(const integer* n, const double* x, double* f, double* fjac, const integer* ldjac, const integer* iflag, void* data);
6060

6161
/*! \fn allocate memory for nonlinear system solver hybrd
6262
*
@@ -305,7 +305,7 @@ static int getAnalyticalJacobian(struct dataAndSys* dataSys, double* jac)
305305
*
306306
*
307307
*/
308-
static int wrapper_fvec_hybrj(const integer* n, const double* x, double* f, double* fjac, const integer* ldjac, const integer* iflag, void* dataAndSysNum)
308+
static void wrapper_fvec_hybrj(const integer* n, const double* x, double* f, double* fjac, const integer* ldjac, const integer* iflag, void* dataAndSysNum)
309309
{
310310
int i,j;
311311
struct dataAndSys *dataSys = (struct dataAndSys*) dataAndSysNum;
@@ -400,8 +400,6 @@ static int wrapper_fvec_hybrj(const integer* n, const double* x, double* f, doub
400400
throwStreamPrint(NULL, "Well, this is embarrasing. The non-linear solver should never call this case.%d", (int)*iflag);
401401
break;
402402
}
403-
404-
return 0;
405403
}
406404

407405
/*! \fn solve non-linear system with hybrd method

SimulationRuntime/c/simulation/solver/nonlinearSolverHybrd.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ extern "C" {
4545
#endif
4646

4747
extern
48-
int hybrj_( int(*) (const integer*, const double*, double*, double *, const integer*, const integer*, void*), const integer *n, double *x, double *fvec, double *fjac, const integer *ldfjac,
48+
void hybrj_( void(*) (const integer*, const double*, double*, double *, const integer*, const integer*, void*), const integer *n, double *x, double *fvec, double *fjac, const integer *ldfjac,
4949
const double *xtol, const integer *axfev, double *diag, const integer *mode,
5050
const double *factor, const integer *nprint, integer *info, integer *nfev, integer *njev,
5151
double *r, integer *lr, double *qtf, double *wa1, double *wa2,

0 commit comments

Comments
 (0)