/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

  1. class 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. -- Compile it using the provided Makefile
  4. insert DYNAMIC_LINKING_LOADER; DL_FLAGS
  5. create {ANY} make
  6. feature {ANY}
  7. lib: STRING "libglib-2.0.so"
  8. make
  9. local dl: DL_LOADER
  10. do
  11. l := new_dynamic_shared_object(lib, rtld_now)
  12. l2 := dl.new_dynamic_shared_object(lib, rtld_now)
  13. check
  14. l ~ l2
  15. end
  16. print (l.symbol("g_date_new").out)
  17. check
  18. l.symbol("g_date_new") = l2.symbol("g_date_new")
  19. end
  20. end
  21. l,l2: DYNAMIC_SHARED_OBJECT
  22. end -- DL_EXAMPLE