Skip to main content
JeffH1
16-Pearl
December 7, 2013
Solved

Prime 3.0 User Function

  • December 7, 2013
  • 2 replies
  • 3426 views

Anyone having trouble linking a user function with the user library in Prime 3.0? I can't even link the basic examples. I get an error message:

External _CreateUserFunction not found

from the linker. It's definitely defined in mcaduser.h that I compiled with. It's like it wasn't exported from mcaduser.lib

Anyone else having this problem?

Best answer by jsheehan

Jeff,

This typically happens to me when I am linking on a 64 bit machine but my Configuration manager in Dev Studio is building a Win32 project.

I build Customer Functions in prime 3.0 all the time and it works fine and CreateuserFunction is definitely resolved by MCADUSER.LIB .. but you have to link 32 bit lib for 32 bit targets and 64 bit lib for 64 bit targets, otherwise underfined errors occur.

2 replies

24-Ruby IV
December 7, 2013

Jeff Henning wrote:

Anyone having trouble linking a user function with the user library in Prime 3.0? I can't even link the basic examples. I get an error message:

External _CreateUserFunction not found

from the linker. It's definitely defined in mcaduser.h that I compiled with. It's like it wasn't exported from mcaduser.lib

Anyone else having this problem?

I have others problem user library in Prime 3.0:wspPrimr.png

jsheehan1-VisitorAnswer
1-Visitor
December 10, 2013

Jeff,

This typically happens to me when I am linking on a 64 bit machine but my Configuration manager in Dev Studio is building a Win32 project.

I build Customer Functions in prime 3.0 all the time and it works fine and CreateuserFunction is definitely resolved by MCADUSER.LIB .. but you have to link 32 bit lib for 32 bit targets and 64 bit lib for 64 bit targets, otherwise underfined errors occur.

JeffH1
JeffH116-PearlAuthor
16-Pearl
December 12, 2013

John,

Thanks muchly. I started figuring out the 32/64-bit issue on my own yesterday and finally go it to compile. When I stopped using the command line instructions that PTC provided in the help and moved to the Visual Studio interface, I realized I had the option between Win32 and x64 platforms. Switching to x64 cleared all the errors and warnings in the link step. Interestingly, Prime 3.0 still gives instructions in the help file for using -DWIN32 on the compile line to create a 32-bit object; when most of the world has moved on to Windows 7 or Windows 8. That needs to be updated; I believe you either leave the switch off, or use the switch -DWINDLL.

Moving my DLL to the Custom Functions directory, however, didn't go so well. None of my functions were recognized and the built-in CustomFunctions routine didn't return any of my function names; in fact, it crashed Prime 3.0. Perusing the Project Properties turned up that I had forgotton to set the DLL Entry Point in VisualStudio. This is a switch on the command line instructions that I missed. Once I did that, all my functions started working and CustomFunctions no longer crashes the programm.

The good news is that my library of functions from my Mathcad 15.0 DLL (there are about 100 of them) compiled directly with absolutely no modification needed to my source code. Outstanding!

The developers need to figure out a way to integrate the custom functions into the interface (like under a Custom Functions category) as well as integrating context sensitive help files into the help system. This was an extremely robust and easy to use system in Mathcad 15.0 that is sorely needed to support DLLs in Prime. My users (600 to 1,000 of them in our company) depend on these help files to make use of these DLL functions. DON'T GIVE UP THE FIGHT! We're behind you!

Thanks!

1-Visitor
December 12, 2013

Awesome news Jeff. I will keep fighting for more support for Custom Functions.

I would love to hear from any developer who has successfully debugged a custom function using Dev Studio .. attached to Mathcad 15 or Prime 3.0 exe. That would be blog worthy in my mind. It shoudl work but with the projects I have I will get to try that in 6 months.