1*0fe97280Skurt /*	$OpenBSD: main.c,v 1.1.1.1 2005/09/23 19:02:29 kurt Exp $	*/
2*0fe97280Skurt 
3*0fe97280Skurt /*
4*0fe97280Skurt  * Copyright (c) 2005 Kurt Miller <kurt@openbsd.org>
5*0fe97280Skurt  *
6*0fe97280Skurt  * Permission to use, copy, modify, and distribute this software for any
7*0fe97280Skurt  * purpose with or without fee is hereby granted, provided that the above
8*0fe97280Skurt  * copyright notice and this permission notice appear in all copies.
9*0fe97280Skurt  *
10*0fe97280Skurt  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11*0fe97280Skurt  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12*0fe97280Skurt  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13*0fe97280Skurt  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14*0fe97280Skurt  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15*0fe97280Skurt  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16*0fe97280Skurt  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17*0fe97280Skurt  */
18*0fe97280Skurt 
19*0fe97280Skurt #include <dlfcn.h>
20*0fe97280Skurt #include <stdio.h>
21*0fe97280Skurt 
22*0fe97280Skurt int
main()23*0fe97280Skurt main()
24*0fe97280Skurt {
25*0fe97280Skurt 	int ret = 0;
26*0fe97280Skurt 	void *libaa;
27*0fe97280Skurt 	void *libbb;
28*0fe97280Skurt 	int (*bbTest1)(void);
29*0fe97280Skurt 
30*0fe97280Skurt 	libaa = dlopen("libaa.so", RTLD_LAZY|RTLD_GLOBAL);
31*0fe97280Skurt 	if (libaa == NULL) {
32*0fe97280Skurt 		printf("dlopen(\"libaa.so\", RTLD_LAZY) FAILED\n");
33*0fe97280Skurt 		return (1);
34*0fe97280Skurt 	}
35*0fe97280Skurt 
36*0fe97280Skurt 	libbb = dlopen("libbb.so", RTLD_LAZY|RTLD_GLOBAL);
37*0fe97280Skurt 	if (libbb == NULL) {
38*0fe97280Skurt 		printf("dlopen(\"libbb.so\", RTLD_LAZY) FAILED\n");
39*0fe97280Skurt 		return (1);
40*0fe97280Skurt 	}
41*0fe97280Skurt 
42*0fe97280Skurt 	bbTest1 = dlsym(libbb, "bbTest1");
43*0fe97280Skurt 
44*0fe97280Skurt 	ret = (*bbTest1)();
45*0fe97280Skurt 
46*0fe97280Skurt 	dlclose(libaa);
47*0fe97280Skurt 	dlclose(libbb);
48*0fe97280Skurt 
49*0fe97280Skurt 	return (ret);
50*0fe97280Skurt }
51