Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register
  • Index
  • » Users
  • » vaceee
  • » Profile

Posts

Posts

Hello,
I am new to OpenModelica and trying to write an external function. I have searched the forum but was not able to find an answer to my questions (compiler errors). Thank you in advance for your help.

My external function file (xmathlib.cpp) is as follows:

// Begin

class Calc
{




}




void AddTwo(double a, double b, double *c)
{

*c = a+b;

}


// End


Question:
When I dont have the class definition listed, the file compiles and I can call my external function from OM.
When the class is as listed above (or even as a part of an include file), I keep getting an error as follows:
error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before Calc.

I have tried several different files etc., but for some reason, I cannot use a class.

We have existing numerical libraries that have been developed in C++ and I would like to write this wrapper xmathlib.c  so that I can call some of the routines from OM.


Any help or pointers are much appreciated. Thank you.

-V

  • Index
  • » Users
  • » vaceee
  • » Profile
You are here: