PageRenderTime 5ms CodeModel.GetById 1ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/src/wrappers/posix/dynamic-linking/example/dl_example.e

http://github.com/tybor/Liberty
Specman e | 30 lines | 20 code | 8 blank | 2 comment | 0 complexity | 7dd9f69a21d4173bd8fdd53014f6b51e MD5 | raw file
 1class DL_EXAMPLE
 2	-- Example of dynamical linker loader interface. It should work out-of-the-box, but I found an nice SmartEiffel bug producing a wrong gcc command.
 3
 4	-- Compile it using the provided Makefile
 5
 6insert DYNAMIC_LINKING_LOADER; DL_FLAGS
 7
 8create {ANY} make
 9
10feature {ANY}
11	lib: STRING "libglib-2.0.so" 
12
13	make
14		local dl: DL_LOADER
15		do
16			l := new_dynamic_shared_object(lib, rtld_now)
17			l2 := dl.new_dynamic_shared_object(lib, rtld_now)
18
19			check
20				l ~ l2
21			end
22
23			print (l.symbol("g_date_new").out)
24
25			check 
26				l.symbol("g_date_new") = l2.symbol("g_date_new")
27			end
28		end
29	l,l2: DYNAMIC_SHARED_OBJECT
30end -- DL_EXAMPLE