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

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

Include standard c++ functions in Creo

Sekar1
13-Aquamarine

Include standard c++ functions in Creo

I have creo toolkit project and I am trying to perform File operations  using Headers :

iostream,fstream,sstream,string.h.

Whenever I try to build the code I am getting Linking errors and the file responsible is Protoolkit_NU.lib.

when I comment the code which is using fstream etc, the project builds fine.

 

I am using Creo M030 and  VS 2015.

I have written all the File operation code in separate Header file and calling it in Creo project.

 

any suggestions ?

 

Thanks and regards,

Sekar

9 REPLIES 9

Hi

 

seems like you use the wrong libs to link against. Some of the definitions are already done in other libs, so you should check which of them and exclude or replace them.

 

You can also ignore all double definitions, but this could result in linker warnings and memory errors.

 

If I need to do this I use options like these.

/ignore:4049 /ignore:4099 /ignore:4217 /FORCE:MULTIPLE

 

Br,

Eike

Sekar1
13-Aquamarine
(To:Eike_Hauptmann)

Thanks for the reply,

 

I am new to creo toolkit customization.

can I import an external C# dll into my Creo Custom toolkit project ?

 

regards,

Sekar

You are in a std. C / C++ Application. So you can do whatever you like (don't forget CCW), but we have decided to use a monolith C/C++ DLL for the reason of path building and depencies also from UNC Path and all that stuff.

 

So as far as I now you need to use COM (C# in C++) or CLR (C++ in C#) to get this running. But I have only used CLR for an async application right now COM only for testing purpose and never have written a real application in it. Also remember that you get a dependency to the installed .NET Version on the Client machine.

 

So I would recommend to use a std. C/C++ library (.lib), but also a C# library or dll (remember to append the search path) should be possible.

 

Br,

Eike

Hi Eike,

I just posted the questions quoted bellow and I was suggested to reach you. So may be you have some clues of how I proceed on? Sorry if this wrong place to ask.

 

My company has just acquired Creo Parametric and it needs to develop add-on extensions to it. From the other hand, we have tons of useful C# code that we we want to reutilize.

I just started to design the extension and my plan was to implement a 3-tier architecture consisting from the following layers:

- DLL client build with Creo Object Toolkit C++, which may be registered as extension to Parametric.exe

- Middleware build with C++/CLI which will allow client/server interop

- C# libraries consumed

Unfortunately, my trials so far to make server DLL extension dependent on the middleware class brought to the Parametric crashes.

I'm absolute newbie to the Parametric programming so I would like to start this first post with some general questions.

Do anyone has the experience with the using C# code from Parametric?

Is the direction I tried makes sense with Parametric?

If yes, what may be the causes for crash? (I will share code files as necessary)

If not, what are the advised directions I can focus on?  

I think you have a dependency problem. 

 

So you use two different systems :

 - One in C / C++ what is assembler / bytecode after compilation

 - One is C# which uses a VM in the background to run the compiled code (near to java than C)

 

The solution is C++/CLI but Parametric did not have CLI. I do not know if you could load a C++/CLI DLL into a plain C++ DLL.

https://www.codeproject.com/Articles/556582/UsingplusC-plusfromplusnativeplusC-b-bpluswith

 

If the calling programm did not have the CLI 'extension' comiled in, than you need to wrap all types so that they are C++ compatible.

 

I have never done this, only the other way arount, using C /C++ from a C# Application (because it's so simple for the UI with XAML, MVVM, ...).

 

Br,

Eike

Thanks a lot for your prompt answer. The problem is that Parametric does not have full .NET support, so we need to start with plain old C++ as the starting point of an extension development.

 

BR.

Yes,

 

else you would have the dependency to .NET. PTC does not want this (I think) so they have the possibility to easily get back to UNIX support.

 

What you can do is to split it in 2 different processes and do a communication between these by e.g. pipe communication. Just as an idea. Then your code would be undependend and the runtime could be startet from PTC Creo in plain C / C++ and direct communiation with your C# application.

 

Br,

Eike

Another Idea would be to create an C# application that work async with the c/c++ and use the port communication from PTC Creo to solve your problem. That would work but also have some difficulties. You need to map all types but can directly use the DLL from your C# program and CLI because you are in an external process.

 

Br,

Eike

Yep. Today with current .Net linux is not the problem anymore + plus there is some limited support for the VB on place.

re pipe communication I am on it. Let you know if I can successfully resolve it.

Thanks again! 

Announcements


Top Tags