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

Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

C or C++ for toolkit | Pros and cons

Ketan_Lalcheta
19-Tanzanite

C or C++ for toolkit | Pros and cons

Hi

 

I started customization using toolkit since ProE 4.0 and never used c files as solution. We used to create cpp files (C++ instead of C) and used extern C for user_initialize.

 

I am wondering what is the best way to go for this? C or C++? 

 

Any thoughts?

4 REPLIES 4
FV
17-Peridot
17-Peridot
(To:Ketan_Lalcheta)


@Ketan_Lalcheta wrote:

Hi

 

I started customization using toolkit since ProE 4.0 and never used c files as solution. We used to create cpp files (C++ instead of C) and used extern C for user_initialize.

 

I am wondering what is the best way to go for this? C or C++? 

 

Any thoughts?


Hello all,

'C or C++' is a good question. 

 

Side note - a source file extension is not a reliable indicator of how the code will be compiled. '.c' and '.cpp' happened to be the default extensions which visual studio knows about and visual studio auto-magically sets compiler flags to either /TC or /TP ...

Another note - extern "C" with user_initialize and user_terminate is only a small part of the deal. What  actually is happening behind the scenes  is Pro/Toolkit authors had made provisions for dual compilation by adding

  PRO_BEGIN_C_DECLS and PRO_END_C_DECLS macros to every header file. Those macros are defined in ProANSI.h file and trace their origins to __cplusplus compiler macro.

 

Back to C/C++ - the good discussion about C being (or not being) a subset of C++ could be found here:

https://stackoverflow.com/questions/1201593/where-is-c-not-a-subset-of-c

 

IMHO, the choice of C or C++ or 'C++ with C' is mostly dictated by the complexity of any given app and not by Pro/Toolkit API. 

Domain driven software design, test driven software development, linking with external third party libraries, using STL containers, namespaces, exceptions, functional or OO style of programming, resource ownership management and so on are the factors requiring careful consideration. 

 

HIH.

FV.  

 

 

@Ketan_Lalcheta  when I use cpp file I couldn't do debug. VS shows error Visual " No Symbols have been loaded for this document"

Have you come across this issue. Kindly help me on this

 

Regards, 

MS

Hi

I can debug with cpp files also...

Try one thing..make copy of your entire code folder for safer side...

Close visual studio. Delete all PDB and sdf files present in folder. Rebuild code and it should now allow you to debug. In property page also, ensure that you have opted for debug information as yes.

I tried but still have issue, if possible kindly share makefile and vs project settings
Announcements


Top Tags