Under SunOS 4.x, Solaris 2.x and HP-UX, the simple object file must be created by compiling the source file with special compiler flags and a shared library must be produced. The necessary steps with HP-UX are as follows. The +z flag to the HP-UX C compiler produces so-called "Position Independent Code" (PIC) and the +u flag removes some alignment restrictions that the PA-RISC architecture normally enforces. The object file must be turned into a shared library using the HP-UX link editor with the -b option. This sounds complicated but is actually very simple, since the commands to do it are just:
SunOS 4.x�� Solaris 2.x�� HP-UX �Ǥϡ� ñ�㥪�֥������ȥե�����ϡ��������ե���������̤ʥ���ѥ���ե� ���դǥ���ѥ��뤷�ƺ��ʤ��ƤϤʤ�ޤ��ޤ�����ͭ�饤�֥�� ����ʤ��ƤϤʤ�ޤ��� HP-UX��ɬ�פʼ��ϼ��ΤȤ���Ǥ��� HP-UX��C����ѥ���� +z �ե饰��Ϳ���뤳�Ȥǡ� �����������Ω�ʥ�����(PIC: Position Independent Code)���ꡢ +u �ե饰��Ϳ���뤳�Ȥǡ�PA-RISC�������ƥ����� �Ǥ��̾ﶯ��Ū�˹Ԥ��륢�饤�������¤�������ޤ��� ���֥������ȥե�����ϡ�HP-UX�Υ�� -b �ե饰��Ȥäơ� ��ͭ�饤�֥����Ѵ����ʤ��ƤϤʤ�ޤ��� ʣ���˸����뤫���Τ�ޤ����ºݤ�ñ��Ǥ����ʤ��ʤ顢�� ��뤿��Υ��ޥ�ɤ�ñ�˼��Τ褦�ʤ�Τ�����Ǥ���
# simple HP-UX example % cc +z +u -c foo.c % ld -b -o foo.sl foo.o
As with the .so files mentioned in the last subsection, the create function command must be told which file is the correct file to load (i.e., you must give it the location of the shared library, or .sl file). Under SunOS 4.x, the commands look like:
�Ǹ����Ǹ��ڤ���Ƥ��� .so �ե�����⤽���Ǥ���褦�ˡ��ؿ����� ���ޥ�ɤˤϡ������ɤ��٤��������ե����뤬�ɤΥե�����Ǥ���Τ��� ���ꤷ�ʤ���Фʤ�ޤ��� (���ʤ������ͭ �饤�֥�ꡢ�⤷���� .sl �ե�����ξ�����ꤷ�ʤ���Фʤ�ʤ��� �Ǥ�)�� SunOS 4.x �ǤΥ��ޥ�ɤϼ��ΤȤ���Ǥ���
# simple SunOS 4.x example % cc -PIC -c foo.c % ld -dc -dp -Bdynamic -o foo.so foo.oand the equivalent lines under Solaris 2.x are: �����ơ�Solaris 2.x �ǤΡ��б����뤽�줾��ιԤϼ��Τ褦�ˤʤ�ޤ���
# simple Solaris 2.x example % cc -K PIC -c foo.c % ld -G -Bdynamic -o foo.so foo.oor �ޤ���
# simple Solaris 2.x example % gcc -fPIC -c foo.c % ld -G -Bdynamic -o foo.so foo.o
When linking shared libraries, you may have to specify some additional shared libraries (typically system libraries, such as the C and math libraries) on your ld command line.
��ͭ�饤�֥���������ˤϡ�ld�Υ��ޥ�ɹԤǡ������Ĥ����ɲ� �ζ�ͭ�饤�֥��(�̾�� C ����ؤΥ饤�֥��ʤɤΥ����ƥ�饤�� ���)����ꤹ�뤳�Ȥˤʤ�Ǥ��礦��