Michael P. Smith<SMTP:[log in to unmask]> asks (among other things):
>Personally, I prefer method 2, but I would like to see what is involved in
>method 3. I have a working version in Pascal, but am unsure how to call a
>function by PLABEL from within C. As usual, the only examples I can find
from
>HP are in FORTRAN, PASCAL and COBOL.
Here's a quick & dirty example that I use alot!
#pragma intrinsic HPGETPROCPLABEL
short get_xlodx_version(char *fname)
{
char xlomnidx[38], func_name[9];
unsigned long status;
short mode321=321, base[2]={0,0}, qual[2]={0,0}, db_stat[21], ver[2];
void (*dbiinfo) (); /* define as pointer to void function (or whatever )
*/
/* make sure XL filename is delimited */
if (fname[0] != ' ') /* Not From HPFIRSTLIBRARY space delimited */
{
strcpy(xlomnidx, " ");
strcat(xlomnidx, fname);
strcat(xlomnidx, " ");
}
/* make sure function name is deliminited */
strcpy(func_name, " dbiinfo ");
HPGETPROCPLABEL( func_name, (int *) &dbiinfo, &status, xlomnidx);
if (status)
return 0;
(*dbiinfo) (base, qual, &mode321, db_stat, ver); /* make the call */
if (db_stat[0])
return 0;
return ver[1];
}
Sorry if this is confusing, it's a quick cut & paste job from a little
utility to find out what version of Omnidex is installed in a particular
library which is passed to this function. The import parts are:
1) declare HPGETPROCPLABEL as intrinsic:
#pragma intrinsic HPGETPROCPLABEL
2) declare a pointer to your function:
void (*dbiinfo) (); /* define as pointer to void function (or
whatever ) */
3) Make sure the XL name and function/procedure name are delimited properly
for HPGETPROCPLABEL. Spaces work great.
4) Call HPGETPROCPLABEL to intialize your pointer with the plable of the
function:
HPGETPROCPLABEL( func_name, (int *) &dbiinfo, &status, xlomnidx);
5) Make the call:
(*dbiinfo) (base, qual, &mode321, db_stat, ver); /* make the call */
Good luck. Feel free to email if you need more help.
Rich
______________________________________________________________________
________ Dynamic Information Systems Corp. |
\!DISC / Rich Trapp | My opinions are my own.
\ / OMNIDEX Product Manager - IMAGE/SQL | With any luck they're
\ / Phone : 303 444-4000 | correct ;-)
\/ E-mail: [log in to unmask] |
----------------------------------------------------------------------
|