Mark Bixby wrote:
>
>
> > My makefiles trot on happily after linking a
> > program with unresolveds - and generate lots of problems
> > later on because of it. They're just stupid UNIX makefiles that do
> > not know about runtime binding ;-)
>
> This issue is a big problem when porting Unix autoconfigure scripts that
> compile test programs to check for various external symbols and expect the
> compile/link to fail in error if any symbols are unresolved.
>
Yup, isn't it just. That's exactly my problem.
Other problems: you can't specify an object output name with c89, and
there's
a limitation on the number of flags and include paths you can specify.
I had to write a wrapper around c89 in order to get our makefiles
working.
Actually there's a patch for the second problem (HPCKX05) but I haven't
installed
it yet.
> The MPE workaround is to try executing your program after the compile/link;
if
> it fails to execute, you assume you have unresolved externals.
Yes, I actually have such a program, source follows below for anyone
interested.
The same idea was also put forward by Keven Miller in a private reply.
Note that it's still not possible just _why_ the load fails,
CREATEPROCESS
will not tell you why. You get the UNRESOLVED message on the screen, but
it gets lost
when you try to redirect it. Anyway, if I put it into the cc wrapper it
nicely
solves the problem from the makeiles' point of view.
--
Kind regards,
Chris Breemer [log in to unmask]
Compuware Europe B.V. http://www.compuware.com
---------------------- cut here
-------------------------------------------------
/*
load.c Test load a program w/o executing
Update log:
15nov95 cbr Created
06mar98 cbr POSIX version (slightly different from MPE version)
*/
#define USAGE "Usage: load file\n"
#pragma intrinsic KILL, CREATEPROCESS
#include <stdlib.h>
#include <mpe.h>
/*====================== main =======================================*/
main (int argc, char **argv)
{
int pin;
char prog[80];
char cwd[101];
argc--; argv++;
if ( !argc )
{
printf(USAGE);
exit(1);
}
if ( **argv != '/' )
sprintf(prog, "%s/%s", getcwd(cwd, 100), *argv);
else
strcpy(prog, *argv);
pin = create_process(prog);
if ( pin < 0 )
exit(-1); /* Not loadable */
KILL(pin);
switch ( ccode() )
{
case CCE:
break;
case CCG:
break;
case CCL:
printf("KILL error: Cannot kill PIN %d\n", pin);
break;
}
exit(0);
}
/*=================== create_process ===============================*/
int create_process (char *prog)
{
int status;
short pin;
int itnum[1];
long itval[1];
itnum[0] = 0; /* Terminator */
itval[0] = 0;
pin = 0;
CREATEPROCESS(&status, &pin, prog, itnum, itval);
switch (status)
{
case 0:
break;
case -9:
case -10:
status = 0;
break;
case 1:
printf("Need PH capability\n");
break;
case 2:
printf("PIN of formaldesig missing\n");
break;
case 3:
printf("PIN or formaldesig out of bounds\n");
break;
case 4:
printf("Out of system resources\n");
break;
case 5:
printf("Invalid itemnum specified\n");
break;
case 6:
printf("Program '%s' does not exist\n", prog);
return -1;
case 7:
printf("Invalid filename '%s'\n", prog);
return -1;
case 8:
printf("Entry name invalid or does not exist\n");
break;
case 15:
printf("Reserved item specified\n");
break;
case 16: /* Hard load error */
printf("Program '%s' is not loadable\n", prog);
return -1;
case 17:
printf("Illegal value for itemnum=7\n");
break;
case 18:
printf("Specified $STDIN could not be opened\n");
break;
case 19:
printf("Specified $STDLIST could not be opened\n");
break;
case 20:
printf("Invalid info specified\n");
break;
default:
printf("Unknown error\n");
break;
}
if (status)
{
printf("(CREATEPROCESS status %d)\n", status);
return -1;
}
return pin;
}
/*=================== the_end ===============================*/
|