I found the answer!
As it might be interesting for other people as well, here is the solution:
1) Don't copy&paste code from a pdf document into your code.
I copied code from AN4329 into my code which did not work.
At some point, I noticed that the section definition ".MY_SECTION" was black instead of blue.
Erased the quotation marks and typed them manually, now they are blue.
The quotation marks are not recognized as quotation marks, and to make it worse, when they appear in a pragma statement there is no syntax error. The pragma statement is simply ignored and you get a totally uncomprehensible error message when you try to refer to that previous pragma.
In my case: the section definition had the wrong quotation marks
The __declspec referring to the previously (not) defined section produced an error
2) Don't put the function in main.c
It was just a little test program.
A small function which resides in the same file as the calling function is optimized away (function inlining).
The section definition is ignored without notice.