Skip to main content
1-Visitor
Feb 15, 2022 3:07 PM UTC
Acknowledged

Adding macros PRO_BEGIN_C_DECLS and PRO_END_C_DECLS to all Toolkit header files

Related products:Creo Parametric

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 replies

olivierlp
Community Manager
Feb 15, 2022 11:15 PM UTC
Status changed to: Acknowledged
Olivier
olivierlp
Community Manager
Feb 15, 2022 11:15 PM UTC

Hello, 

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

Olivier
1-Visitor
Feb 16, 2022 7:15 AM UTC

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
Feb 16, 2022 12:21 PM UTC

Thanks for these additional details. 

Olivier