cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

The PTC Community email address has changed to community-mailer@ptc.com. Learn more.

Adding macros PRO_BEGIN_C_DECLS and PRO_END_C_DECLS to all Toolkit header files

Adding macros PRO_BEGIN_C_DECLS and PRO_END_C_DECLS to all Toolkit header files

1. Describe your environment: What is your industry? What is your role in your organization? Describe your stakeholders.
The organization where I work is in the manufacturing industry.
In the organization I am responsible for the CAD and PDM system administration as well as for the Toolkit development.
I support about 300 Creo Parametric users.


2. What version of Creo Parametric are you currently running?
We are currently working with Creo Parametric 7.0.6.0.

3. Describtion of the idea
To allow standard header files such as ProToolkit.h to be easily used in C++ code files, they all contain the PRO_BEGIN_C_DECLS and PRO_END_C_DECLS macros defined in the ProANSI.h file.
The non-default header files from the directory <Toolkit_directory>\protk_appls\includes do not contain these macros (except for the four files GearDesign.h, TestError.h, TestSleep.h and UtilTypes.h).
Therefore, in my opinion, it would be an easily implemented improvement if the macros PRO_BEGIN_C_DECLS and PRO_END_C_DECLS were added to the rest of the header files as well!

4 Comments
olivierlp
Community Manager
Status changed to: Acknowledged
 
olivierlp
Community Manager

Hello, 

Thank you for your idea and the information you provided. I'd encourage you to detail the business benefits for your organization. 

DomenicLaritz
16-Pearl

The business benefit is probably negligible for my company with two Toolkit developers.
But if you consider all PTC customers who develop auxiliary applications with Toolkit, it would very well be a relief if the idea would be implemented.

 

If you include header files in a *.cpp file (i.e. C++ code file) that do not contain the said macros, you usually run into an error first during the build process: More precisely, the linker error LNK2019, which can have a wide variety of causes.
The problem can be solved with a workaround by enclosing the header files with extern "C" { } - e.g.:

extern "C"
{
#include <UtilVisit.h>
}

 

If all header files shipped with Toolkit uniformly contained said macros, it would probably save some trouble and debugging effort!

olivierlp
Community Manager

Thanks for these additional details.