are functions in a .cpp file always C++?

Hi,
I have a sketch using functions implemented in a .cpp file. These functions are written like C-functions, i.e. they are not methods of a class.

When I call these functions from the sketch everything is ok.
When I call them from a method of a class, I get wrong results.

To get rid of problems I am calling them from the sketch. But I'd like to have a better structured code and therefore it would be better to call them from methods of a class.

At first I supposed to have issues with free RAM because calling functions within functions increases the stack size. Checking this with freeRam() told me that there is no problem with free RAM.

Now my question is, if it is necessary to include the function declarations in the brackets of
extern "C" {

}.
Of course I could just do so and try it. But if somebody can give me a clear statement about this problem I could avoid the effort to do all the necessary changes in the code.

Any idea?

SupArdu

Any idea?

You want us to have ideas about code you did not post. Boy, do I. But, rather than express THEM, I'll wait for you to actually post the code that you are having trouble with.

It is necessary to wrap functions defined in a header file that are implemented in a c file in the extern C wrapper. It is not necessary to do that for functions implemented in a cpp file.

It is necessary to wrap functions defined in a header file that are implemented in a c file in the extern C wrapper. It is not necessary to do that for functions implemented in a cpp file.

Thank you very much.
Your statement exactly answers my question.
But now I still have to search the error in my code :frowning:

SudArdu

But now I still have to search the error in my code

We could help.