From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,28a1602031398c42 X-Google-Attributes: gidfee84,public From: Tim Lucia Subject: Re: How do I create a shared library? Date: 1996/07/19 Message-ID: <31EF8CAA.2D85@zko.dec.com>#1/1 X-Deja-AN: 168855297 references: <837508279.640.0@fersys.demon.co.uk> to: mlb@fersys.demon.co.uk content-type: multipart/mixed; boundary="------------19A169D8353C" organization: Digital Equipment Corporation, Digital Ladebug Debugger mime-version: 1.0 newsgroups: comp.unix.osf.osf1 x-mailer: Mozilla 2.0 (X11; I; OSF1 V3.2 alpha) This is a multi-part message in MIME format. --------------19A169D8353C Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Here is a simple example of creating a shared library and calling a routine within. Regards, Tim -- Timothy J. Lucia Email: mailto:lucia@zko.dec.com Digital Equipment Corporation Phone: 603.881.2615 110 Spitbrook Road ZK2-3Q08 Fax: 603.881.0120 Nashua, NH USA 03062-2698 I'd rather be cycling. --------------19A169D8353C Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="SHARED_LIBRARY_EXAMPLE" Jul 19 09:23 1996 library.c Page 1 #include void bar(void) { printf("Inside shared library:bar()\n"); } Jul 19 09:23 1996 main.c Page 1 #include void main(void) { extern void bar(void); printf("Inside of main\n"); bar(); } Jul 19 09:22 1996 makefile Page 1 # # Simple example of how to build a shared library on Digital UNIX(tm). # Written by: Timothy J. Lucia, lucia@zko.dec.com # DEBUGFLAGS = -g -O0 CCFLAGS = $(DEBUGFLAGS) CC = cc $(CCFLAGS) LDFLAGS = $(DEBUGFLAGS) LD = ld $(LDFLAGS) RM = rm -f all: main library.so main: main.o library.so $(CC) -o main main.o library.so main.o: main.c $(CC) -c main.c library.so: library.o $(LD) -shared -o library.so library.o -lc library.o: library.c $(CC) -c library.c clean: $(RM) main library main.o library.o library.so so_locations --------------19A169D8353C--