Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2019-01

h2pas fails on c++ header file

6 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Giuliano Colla

I have a c++ module which just performs calculations, and does not use c++ objects. Just c++ syntax. The header file which is used from a c++ main, is the following:

extern int delta_calcForward(float theta1, float theta2, float theta3, float &x0, float &y0, float &z0);
extern int delta_calcInverse(float x0, float y0, float z0, float &theta1, float &theta2, float &theta3);

Invoking h2pas with the following command line:

h2pas -e -p -D -i deltarobcpp.h

generates an "Internal error 1 in line 1". The temporary files generated, ext*.tmp, are all of zero length.

Platform is Linux x86_64, tested with h2pas from different fpc releases from 2.6.4 to trunk.

What I'm doing wrong?

Giuliano

Do not do to others as you would have them do to you.They might have different tastes.
Marco van de Voort
to Giuliano Colla

Op 1/30/2019 om 11:57 AM schreef Giuliano Colla:

What I'm doing wrong?

Using a C header converter or a C++ header file.   & is not proper C.

Giuliano Colla
to Marco van de Voort

Il 30/01/2019 13:17, Marco van de Voort ha scritto:

Show quoted text 7 lines
Op 1/30/2019 om 11:57 AM schreef Giuliano Colla: > > What I'm doing wrong? > Using a C header converter or a C++ header file.   & is not proper C.

That is because h2pas is unable to handle it, or because fpc is unable to generate the proper code for a c++ parameter by reference?

Do not do to others as you would have them do to you.They might have different tastes.
Sven Barth
to Giuliano Colla

Am Do., 31. Jan. 2019, 17:38 hat Giuliano Colla <

Show quoted text 15 lines
geschrieben: Il 30/01/2019 13:17, Marco van de Voort ha scritto: > > Op 1/30/2019 om 11:57 AM schreef Giuliano Colla: >> >> What I'm doing wrong? >> > Using a C header converter or a C++ header file. & is not proper C. > That is because h2pas is unable to handle it, or because fpc is unable to generate the proper code for a c++ parameter by reference

The former. For the later you'd either use var or constref. Though there'd still be the topic of name mangling... (FPC's cppdecl is not that good yet)

Regards,
Sven

Marco van de Voort
to Sven Barth

Op 2019-01-31 om 19:00 schreef Sven Barth via fpc-pascal:

Show quoted text 10 lines
That is because h2pas is unable to handle it, or because fpc is unable to generate the proper code for a c++ parameter by reference The former. For the later you'd either use var or constref. Though there'd still be the topic of name mangling... (FPC's cppdecl is not that good yet)

And I guess it should be a simple type, not a smartpointer.

Giuliano Colla
to Marco van de Voort

Il 01/02/2019 10:37, Marco van de Voort ha scritto:

Show quoted text 13 lines
Op 2019-01-31 om 19:00 schreef Sven Barth via fpc-pascal: > >     That is because h2pas is unable to handle it, or because fpc is >     unable >     to generate the proper code for a c++ parameter by reference > > > The former. For the later you'd either use var or constref. Though > there'd still be the topic of name mangling... (FPC's cppdecl is not > that good yet) > And I guess it should be a simple type, not a smartpointer.

IOW a pure C wrapper around the C++ module would be the only easy way out at the moment?

Giuliano

Do not do to others as you would have them do to you.They might have different tastes.