Operating System - OpenVMS
1828838 Members
2678 Online
109985 Solutions
New Discussion

How do you run a C++ EXE from a COM File

 
SOLVED
Go to solution
Kenneth Toler
Frequent Advisor

How do you run a C++ EXE from a COM File

How do you run a C++ executable from a DCL/COM File?

Thanks
3 REPLIES 3
Steven Schweda
Honored Contributor
Solution

Re: How do you run a C++ EXE from a COM File

The same ways as you run any other executable
from a DCL command procedure?

If you don't need any command-line arguments,
"RUN dev:[dir]program.exe".

If you do need command-line arguments, I'd
define a foreign-command symbol, like:

program = "$ dev:[dir]program.exe"
program arg1 arg2 arg3 [...]

Or, see the VMS FAQ:

http://h71000.www7.hp.com/faq/openvms_faq.html
http://h71000.www7.hp.com/faq/vmsfaq_stmlf.txt

and look for "HOW DO I RUN A PROGRAM WITH
ARGUMENTS?"
John Gillings
Honored Contributor

Re: How do you run a C++ EXE from a COM File

Two other options, the the directory containing your image file is in the search path for the logical name DCL$PATH, then just use the name of the image:

$ DEFINE DCL$PATH dir:[dev],...

...
$ program arg1 arg2 arg3 ...

(in other words, similar to Unix, DOS, Windows etc)

You can also avoid defining a foreign command symbol for one off use with the MCR command:

$ MCR dir:[dev]program arg1 arg2 arg3 ...

yes, MCR is undocumented and unsupported, but if it was ever changed, so much existing OpenVMS code would break, it just won't ever happen!
A crucible of informative mistakes
Hein van den Heuvel
Honored Contributor

Re: How do you run a C++ EXE from a COM File

What did you try?
What is the observed problem?
Any (error) messages?
Is this a batch job, or an interactively activated command file or something more elaborate from a detached process as your prior questionts hint to?
Be specific, be very specific!

Steven and John speculated on argument passing being the problem.

My guess is that you might not know that when you run an image in a command file then that command file is the input stream.
If you want the originating terminal to provide input and then you need to redefine sys$input temporarely, typically using:

$DEFINE/USER SYS$INPUT SYS$COMMAND

Finally, use the force: $HELP and the OpenVMS Documentation set, such as the Userguide!


Good luck,
Hein.