Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!munnari.oz.au!mullian!dpd From: dpd@mullian.ee.mu.oz.au (Denis Dowling) Newsgroups: comp.lang.c Subject: Re: Incorporating Users' Functions Keywords: nlist Message-ID: <5527@munnari.oz.au> Date: 18 Sep 90 03:51:03 GMT References: <11954@crdgw1.crd.ge.com> Sender: news@cs.mu.oz.au Reply-To: dpd@mullian.ee.mu.OZ.AU (Denis Dowling) Organization: Dept. of Electrical Engineering, University of Melbourne Lines: 49 In article <11954@crdgw1.crd.ge.com> larocque@jupiter.crd.ge.com (David M. LaRocque) writes: >I'm looking for suggestions on the best technique to incorporate >user-written functions into a software package I'm developing. >could be dealt with with the varargs facility. [Description Deleted] >I suppose what might be ideal is to have the user create all his >functions in a separate file that is compiled into the main >program. Then I think the problem becomes finding out what a >function's pointer is when one only knows the name of the function. Have you had a look at the nlist(3) call? The synopsis is given below. NAME nlist - get entries from symbol table SYNOPSIS #include int nlist(filename, nl) char *filename; struct nlist *nl; This will return the symbol table entry for the specified symbol. The nlist structure has a value field that can be cast to a function pointer. I have used this for a system similar to what you describe. I do not know of any clean way to deal with function arguments though. What is needed is a reverse form of varargs that allows the construction of an argument list for passing to a function. Anyone have any ideas? It might pay you to have a look at the recent postings in alt.sources on dynamic loading of proceedures in unix. This can allow functions to be loaded on the fly as needed and not have to be explicitly linked with the executable program. > >Thanks, Dave > >/************************************************** > * larocque@crd.ge.com (518) 387-5805 > * ...!crdgw1!cetus.crd.ge.com!larocque > **************************************************/ ______________________________________________________________________________ Denis Dowling ACSnet : dpd@mullian.mu.oz SITEE - (Elec Eng) uunet : uunet!munnari!mullian!dpd University of Melbourne internet : dpd@mullian.mu.oz.au