home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!gatech!rutgers!cbmvax!jesup
- From: jesup@cbmvax.commodore.com (Randell Jesup)
- Newsgroups: comp.sys.amiga.programmer
- Subject: Re: Passing arguments to a process
- Message-ID: <34560@cbmvax.commodore.com>
- Date: 21 Aug 92 21:32:36 GMT
- References: <14kpbcINNfkn@darkstar.UCSC.EDU>
- Reply-To: jesup@cbmvax.commodore.com (Randell Jesup)
- Distribution: usa
- Organization: Commodore, West Chester, PA
- Lines: 46
-
- torp@cats.ucsc.edu (Judith Lynn Nakamura) writes:
- >Using CreateNewProc(), how do I pass an argument (pointer or string)
- >to the new process? I have tried
- >
- >strunct TagItem new_process_tags[] = {
- > NP_Entry, entry_point,
- > NP_Arguments, "argument"
- > TAG_DONE
- >};
- >
- >but the function entry_point() does not recieve the string "argument".
-
- I suspect entry_point() is entry_point(char *foo), and is expecting
- the arguments on the stack. What happens is that CreateNewProc() enters
- entry_point() with everything set up as if you had just started a program.
- Thus a0 will have a pointer to a copy of the string, and d0 will have the
- length. In SAS, you would prototype the routine as:
-
- LONG __asm __saveds
- entry_point (register __a0 char *args, register __d0 LONG arglen);
-
- (__saveds is needed to set up A4 to point to any global data, needed unless
- you compile with -b0 and link with lcnb.lib).
-
- I prefer to use macros to make things readable/portable:
- #define ASM __asm
- #define LOAD_A4 __saveds
- #define REG(x) register __ ## x
-
- (## is the ANSI token-pasting function).
-
- So that would become:
- LONG ASM LOAD_A4 entry_point (REG(a0) char *args, REG(d0) LONG arglen);
-
- >Oh, BTW, why doesn't the 2.0 Libraries RKM discuss the dos.library?
-
- Dos is covered in the Bantam AmigaDos Manual, 3rd. Ed. There are
- contractual reasons dating back to <1.0.
-
- --
- "Rev on the redline, you're on your own; seems like a lifetime, but soon it's
- gone..." Foreigner
- -
- Randell Jesup, Jack-of-quite-a-few-trades, Commodore Engineering.
- {uunet|rutgers}!cbmvax!jesup, jesup@cbmvax.cbm.commodore.com BIX: rjesup
- Disclaimer: Nothing I say is anything other than my personal opinion.
-