[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: idl process id
- Subject: Re: idl process id
- From: steinhh(at)ulrik.uio.no (Stein Vidar Hagfors Haugan)
- Date: 23 Apr 1998 08:05:05 GMT
- In-reply-to: "Richard G. French"'s message of Wed, 22 Apr 1998 16:59:29 -0400
- Newsgroups: comp.lang.idl-pvwave
- Organization: University of Oslo, Norway
- References: <6hgr8e$qs3$1@nnrp1.dejanews.com><6hgtco$bmf$1@agate.berkeley.edu><88hg3n8954.fsf@haifung.jpl.nasa.gov><353E5A31.A9EF6C7E@wellesley.edu>
- Xref: news.doit.wisc.edu comp.lang.idl-pvwave:10786
> > IDL> result=call_external('/lib/libc.so.1.9','getpid')
> Does anyone know how to get this to work on a DEC alpha?
> I can't find a shared object version of libc in my /lib
> directory.
Look in /shlib instead:
IDL> result=call_external('/shlib/libc.so','getpid')
IDL> print,result
31185
With the easy-going way of adding new system routines that I found
two days ago, just compile the below included C-code into a
shareable object file (remember to link in $IDL_DIR/bin/bin.alpha),
initialize with
IDL> print,call_external('gmain.so','addmain')
and then you go:
IDL> print,getpid()
(This is perhaps not a good example of this utility - since it's
possible to do this with a single-line call_external statement,
but it does illustrate how easy it is to expand IDL by adding
"built-in" routines that are able to return honest-to-RSI *variables*).
Regards,
Stein Vidar
-----------------------------------------------------gmain.c
#include <unistd.h>
#include <stdio.h>
#include "export.h"
#define NULL_VPTR ((IDL_VPTR) NULL)
IDL_VPTR GETPID(int argc, IDL_VPTR argv[])
{
IDL_VPTR tmp = IDL_Gettmp();
if (tmp==NULL_VPTR) {
IDL_Message(IDL_M_NAMED_GENERIC,IDL_MSG_LONGJMP,
"Couldn't create temporary variable");
}
tmp->type = IDL_TYP_LONG;
tmp->value.l = getpid();
return tmp;
}
IDL_SYSFUN_DEF main_def[] = {{(IDL_FUN_RET) GETPID,"GETPID", 0, 0}};
IDL_LONG addmain(int argc,char *argv[])
{
IDL_AddSystemRoutine(main_def,IDL_TRUE,1); /* Just add getpid */
return 0;
}