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

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

Compiling with CLR

ptc-93473
1-Newbie

Compiling with CLR


Has anyone been able to get a DLL to compile and launch with the CLR flag in order to use .net assemblies in your dlls?

I am able to get it to compile without the /CLR flag and it runs, I add the /CLR and get a beautiful PRO_TK_GEN_ERR starting the application.

If there is another way to call .net c++ code that can call Toolkit functions, I'm open to trying that too.

Patrick Johnson
[cid:image002.jpg@01CA3256.833A6920]


This thread is inactive and closed by the PTC Community Management Team. If you would like to provide a reply and re-open this thread, please notify the moderator and reference the thread. You may also use "Start a topic" button to ask a new question. Please be sure to include what version of the PTC product you are using so another community member knowledgeable about your version may be able to assist.
2 REPLIES 2


Here is something odd about this problem.

If I change the compiler to create an exe vs a dll and link to the protkmd.lib file vs the protk_dllmd.lib file, and make the appropriate changes to the protk.dat file to spawn and look for the exe file. It works as I would like.

Now if I go back to the dll setup, lib and protk.dat file it still doesn't work. When I try to break at the first line in the user_initialize function, it never gets to it. Sounds like there is some sort of decoration of the function when it is compiled that doesn't call correctly from Pro/E to the dll when initializing the dll. However this doesn't appear to be the case for the exe that is spawned.

I am prefixing the user_initialize function with extern "C" to get it to link, again same as when compiled for the exe version too.

Odd, any thoughts from anyone?

Patrick Johnson
[cid:image004.jpg@01CA326A.30FC6550]


Patrick,
Since Pro/ENGINEER isn't using the CLR (it's not a .NET application) your DLL will not find it when it is launched. If you need to call .NET functions from your Pro/TOOLKIT DLL then I would look up the interop functions in the help. You can call .NET from C/C++ and vice versa. I have done this in the past with another application and it worked quite well. If you would like some more detail then please don't hesitate to give me a call.

Patrick Williams | Engineering Systems | Sr. Applications Engineer | Steelcase Inc. | 616.698.4078

[cid:image002.jpg@01CA32B9.2DAEA800]
Top Tags