putting my money where my mouth is (re: the novel idea)

sean finney seanius at debian.org
Mon May 9 15:52:13 CEST 2005


so, in light of last night's discussion, i decided to throw together
a small proof of concept to illustrate my point.  attached are three
files:

	- check_hello.c, a simple "plugin" that prints hello world.
	- a Makefile that illustrates just how easy it is to build a
	  shared object in the way i suggested
	- dltest.c, a program that benchmarks one vs. the other by
	  executing the system/function calls 1000 times and recording
	  elapsed time in microseconds (i'd recommend piping stdout
	  to /dev/null)

this is what i get:

copelandia[~/nagiosplug/plugtest]09:41:03$ ./dltest >/dev/null
dlopen: 131
system: 3698327


	sean
-------------- next part --------------
A non-text attachment was scrubbed...
Name: check_hello.c
Type: text/x-csrc
Size: 62 bytes
Desc: not available
URL: <https://www.monitoring-lists.org/archive/developers/attachments/20050509/53d6d7cf/attachment.c>
-------------- next part --------------
dltest:	dltest.c
	gcc -g -o dltest dltest.c -ldl

check_hello.o: check_hello.c
	gcc -c check_hello.c

check_hello.shared.o: check_hello.c
	gcc -c -fPIC -Dmain=check_hello check_hello.c

check_hello: check_hello.o
	gcc -o check_hello check_hello.o

check_hello.so: check_hello.shared.o
	ld -shared -o check_hello.so check_hello.o

test:
	./dltest
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dltest.c
Type: text/x-csrc
Size: 1109 bytes
Desc: not available
URL: <https://www.monitoring-lists.org/archive/developers/attachments/20050509/53d6d7cf/attachment-0001.c>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <https://www.monitoring-lists.org/archive/developers/attachments/20050509/53d6d7cf/attachment.sig>


More information about the Developers mailing list