h2pas fails on c++ header file

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

h2pas fails on c++ header file

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.

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: h2pas fails on c++ header file

Marco van de Voort-3

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.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: h2pas fails on c++ header file

Giuliano Colla
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?

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

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: h2pas fails on c++ header file

Free Pascal - General mailing list
Am Do., 31. Jan. 2019, 17:38 hat Giuliano Colla <[hidden email]> 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 

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: h2pas fails on c++ header file

Marco van de Voort-2

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.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: h2pas fails on c++ header file

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

>
> 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.

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal