From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,80b1437f838eac18,start X-Google-Attributes: gidfee84,public From: time@ice.com (Tim Endres) Subject: HOW? Dynamically load subroutine at runtime. Date: 1995/04/04 Message-ID: <999999.qeo8kr@tbomb.ice.com>#1/1 X-Deja-AN: 100926831 organization: ICE Engineering, Inc. reply-to: time@ice.com (Tim Endres) newsgroups: comp.unix.osf.osf1 x-mailer: UUCP/Connect - Macintosh Release: 1.8v1 I have an application with a common shell that wants to "plug in" a subroutine to perform the computation. In other words, I wish to produce a program that is missing one subroutine and then use dlopen() to load the subroutine that I wish to use at runtime. What I am very confused about is how to link the subroutine to be loaded, and more importantly, the program that will load it. I can not seem to get past the "unresolved external", and it seems that anytime that I do I dump core as soon as I enter the program and try to call fprintf(). Could someone please explain how to link the two files so that I may use dlopen() to load and resolve a subroutine call at runtime? Assume that the subroutine is in a file called "sub.c" and is named "dyna_sub()", and assume that program is in a file named "prgm.c", and its main() makes a call to "dyna_sub()". thank you