Mathcad Prime 9, DLL in C, use of 'INFILE' / 'OUTFILE' example code request
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Mathcad Prime 9, DLL in C, use of 'INFILE' / 'OUTFILE' example code request
I would like to write a user-defined function for Mathcad Prime 9.0 accessible via DLL. I intend to use 'C' programming language. Your supplied header file (excerpt below) refers to methods of function definition which will pass string pointers that are automatically parsed into file names with full paths as needed (#define INFILE 13). There is also discussion of assigning the function output to a file which will be written (#define OUTFILE 14). I would like to use this functionality. Can you supply working example 'C' code? In the worst case, maybe you can supply working 'C++' code. What I have tried, with the same construction as your examples for other passed-in arguments, as well correct memory allocation for output strings, has not worked. Of course, I don't know why and I don't think I have a way to debug this in real time since I don't have your object files (also I am a beginner C programmer). Thank you in advance for the example code. - Kirk Morgan
********
// types to be used in declaration of the function's
// arguments and of the return value
#define COMPLEX_SCALAR 1
#define COMPLEX_ARRAY 2
#define STRING 8
//
// File name variables. These are passed as const char *pointers
// if the string doesn't look like it has a path in it then
// the current working directory will be prepended to the string
// before it is passed to the user function.
//
//
// your function will be passed a const char * pointer
#define INFILE 13
// an OUTFILE is like an INFILE except it allows you
// to put your function on the left side of a := like
// the WRITEPRN() builtin
#define OUTFILE 14
// use this structure to create a function
#define MAX_ARGS 10
- Labels:
-
Other
-
Programming
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi,
I suggest starting with the help file which has an example in C++
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I guess that does not answer the question of the OP. Unless the examples contain the use of OUTFILE in working order.
Luc
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Luc seems to have understood the OP question perfectly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
No wonder, considering that this is an old question, formulated some 10 years ago by...
https://community.ptc.com/t5/Mathcad/creating-a-user-DLL-function-like-WRITEPRN/m-p/321606#M125563
Luc
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Ya, Luc - I read that one a week or so ago and thought I "liked" it or something to affirm it. You are waiting for Godot much longer! - Kirk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I can confirm that I do not wish to make a Win32 program using the Mathcad Prime Application Programming Interface.
Instead, I want to make a DLL in C for Mathcad Prime 9, like the documentation says I can, like I have in fact performed.
I compiled and ran the test examples given for command line compilation using MS CL compiler.
I also got the process to run in VS Code with CMake and all that.
But what I want is the INFILE / OUTFILE arguments per the Prime 9 C header file MCADINCL.H to work -> and I have tried stuff there with no success.
I expect the professionals to help, for this is what the support fees cover.
Thank you!!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Then you should realise that, while this forum is supplied/supported by PTC, it is done so that users of the software can interact. Some users are more active than others, but (as far as I know) none of the users are payed for this work. Speaking for myself: I help other users via this forum because I like to do that, often because a question from another user is intriguing or particularly challenging and sometimes I learn a little bit too.
Every now and then you may see a PTC employee respond to a topic, but it's certainly no rule. You can distinguish them from 'mere users' because PTC employees carry badges with a PTC logo.
Success!
Luc