You are on page 1of 18

Calling a share object in Unison

2016/10/27
Content
• Compile as an .un.so by Unison’s software
• Compile as a .so by a regular Unix/Linux(outside Unison)

2
Unison Manual

3
OS and Software version
• CentOS5.4 + U4.2.3
• use Linux command “lsb_release –a” to check OS

• and “/lib/libc.so.6” for compiled information in this system

4
Method 1 : .un.so
.un.so
Method 1 : .un.so
• Step 1 : to new an application library

• Step 2 : compile
– a new .un.so is generated

6
Method 1 : .un.so
• Step 3 : to set the search paths for this new application
library in .una

• Step 4 : delete this new application library in .una

7
Method 1 : .un.so
• Step 5 : reload test program and you will see this new
library was loaded

8
Method 1 : .un.so
• Step 6 : add the application library dependency for your
test program

9
Method 1 : .un.so
• Step 6 : add the application library dependency for your
test program

10
Method 1 : .un.so
• Step 7 : #include .h file and then compile your test program,
now you can access the new .un.so subrountine

11
Method 1 : .un.so
• Step 8 : Execution result. A series of character show in the
new .un.so also print out by your test program.

12
Method 2 : .so
Method 2 : .so
• Step 1 : using C compiler to generate a regular linux share
object for Unison to call.

14
Method 2 : .so
• Step 2 : to add this .so into your linker flags of your
application library

15
Method 2 : .so
• Step 3 : to add extern “C” in your calling program then the
outside .so can be recognized and used.

16
Method 2 : .so
• Step 4 : : Execution result. A series of character transfer in
dataviewer from outside .so

17
Thank You !

You might also like