C 사용자 정의 확장 구성요소 컴파일

시작하기 전에

C로 쓰여진 사용자 정의 확장이 있어야 합니다. 이것은 샘플 노드 파일에서 설명한 제공된 샘플 노드 중 하나이거나 샘플 구문 분석기 파일에서 설명된 샘플 구문 분석기 또는 C로 메시지 처리 또는 출력 노드 작성, C로 입력 노드 작성C로 구문 분석기 작성의 지시사항을 사용하여 사용자 자신이 작성한 노드나 구문 분석기일 수 있습니다. 사용자 정의 노드 이름은 <nodename>.lil 형식이어야 합니다.

이 절에서는 지원되는 모든 플랫폼용 사용자 정의 정의 확장 구성요소를 컴파일하는 방법에 대한 정보를 제공합니다.

본 지시사항에서 사용된 파일 이름은 제공된 샘플의 파일 이름입니다. 자체 사용자 정의 확장 컴파일하는 경우, 이 파일 이름을 자체 파일 이름으로 바꾸어야 합니다.

필수조건

사용자 정의 확장 구성요소를 컴파일하기 전에 사용자의 운영 체제에 의해 지원되는 적절한 컴파일러가 있는지 확인하십시오. 적절한 컴파일러의 예제는 다음과 같습니다.

Windows의 경우, Microsoft Visual C++ .NET 2003

AIX의 경우, AIX용 VisualAge® C++ 버전 6.0

HP-UX의 경우, HP ANSI C 03.52

Linux(x86 플랫폼)Linux(zSeries 플랫폼) 2.4 Kernel 및 2.6 Kernel의 경우, Gnu g++ 버전 3.2 이상

Linux(POWER 플랫폼)의 경우, Gnu g++ 버전 3.3 이상

Solaris SPARC의 경우:
  • Sun ONE Studio 7, Solaris Enterprise Edition
  • Sun ONE Studio 8, Compiler Collection

Solaris x86-64의 경우, Sun Studio 10

z/OS Language Environment (LE) z/OS 1.5, z/OS 1.6의 경우, z/OS C/C++ 1.5 이상

헤더 파일

C 인터페이스는 다음 헤더 파일에 정의됩니다.
BipCni.h
메시지 처리 노드
BipCpi.h
메시지 구문 분석기
BipCci.h
노드와 구문 분석기에 공통된 인터페이스
BipCos.h
플랫폼별 정의

기존에 고객이나 Third-Party에서 제공한 사용자 정의 확장 구성요소 라이브러리를 수정하거나 다시 컴파일하지 않아도 WebSphere Message Broker 브로커에서 실행되지만, Workbench에서 이를 수동으로 작성해야 합니다.

컴파일

지원되는 각 플랫폼에서 사용자 정의 확장 구성요소의 소스를 컴파일하면 브로커가 사용자 정의 확장 구성요소를 구현하는 데 필요한 LIL(oadable implementation library) 파일이 작성됩니다.

사용자 정의 확장 코드가 있는 디렉토리로 이동하십시오. 예를 들면,
  cd install_dir\sample\extensions\nodes\  (Windows)
 
  cd install_dir/sample/extensions/nodes(LinuxUNIX 플랫폼)

Windows에서 컴파일

다음 명령을 사용하여 Windows에서 사용자 정의 노드를 컴파일하십시오(Microsoft 32-bit C/C++ 컴파일러를 Microsoft Visual Studio C++ 버전 7.1에서 사용할 수 있는 경우).
  cl /VERBOSE /LD /MD /Zi /I. /I..\..\..\include\plugin SwitchNode.c 
BipSampPluginUtil.c Common.c NodeFactory.c TransformNode.c -link 
/DLL ..\..\..\lib\imbdfplg.lib /OUT:SwitchNode.lil
주: 이 명령의 길이 때문에 명령을 여러 행에 펼쳐서 표시해야 합니다. 명령을 입력할 때 SwitchNode.cBipSampPluginUtil.c 사이, -link/DLL 사이에 공간을 포함시켰는지 확인하십시오.

AIX에서 컴파일

다음과 같이 지원되는 C 컴파일러를 사용하여 AIX에서 사용자 정의 노드를 컴파일하고 링크하십시오.
xlc_r \
   -I. \
   -I /opt/IBM/mqsi/6.0/include/plugin \
      -c SwitchNode.c \
   -o SwitchNode.o

xlc_r \
   -I. \
   -I /opt/IBM/mqsi/6.0/include/plugin \
      -c BipSampPluginUtil.c \
   -o BipSampPluginUtil.o

xlc_r \
   -I. \
   -I /opt/IBM/mqsi/6.0/include/plugin \
   -c Common.c \
   -o Common.o

xlc_r \
   -I. \
   -I /opt/IBM/mqsi/6.0/include/plugin \
   -c NodeFactory.c \
   -o NodeFactory.o

xlc_r -qmkshrobj \
      -bM:SRE \
      -bexpall \
      -bnoentry \
      -o SwitchNode.lil SwitchNode.o BipSampPluginUtil.o Common.o NodeFactory.o \
      -L /opt/IBM/mqsi/6.0/lib
         -l imbdfplg

chmod a+r SwitchNode.lil

HP-UX에서 컴파일

다음과 같이 지원되는 C 컴파일러를 사용하여 HP-UX에서 사용자 정의 노드를 컴파일하고 링크하십시오.
cc +z \
-I. \
   -I<install_dir>/include \
   -I<install_dir>/include/plugin \
      -c BipSampPluginUtil.c \
   -o <output_dir>/BipSampPluginUtil.o

cc +z \
-I. \
   -I<install_dir>/include \
   -I<install_dir>/include/plugin \
   -c Common.c \
   -o <output_dir>/Common.o

cc +z \
-I. \
   -I<install_dir>/include \
   -I<install_dir>/include/plugin \
   -c NodeFactory.c \
   -o <output_dir>/NodeFactory.o

cc +z \
-I. \
   -I<install_dir>/include \
   -I<install_dir>/include/plugin \
      -c SwitchNode.c \
   -o <output_dir>/SwitchNode.o

cc +z \
-I. \
   -I<install_dir>/include \
   -I<install_dir>/include/plugin \
   -c TransformNode.c \
   -o <output_dir>/TransformNode.o


ld -b \
   -o <output_dir>/SwitchNode.lil \
   <output_dir>/BipSampPluginUtil.o \
   <output_dir>/Common.o \
   <output_dir>/NodeFactory.o \
   <output_dir>/SwitchNode.o \
   <output_dir>/TransformNode.o \
   -L <install_dir>/lib \
   -L <install_dir>/xml4c/lib \
   -L <install_dir>/merant/lib \
   -L <install_dir>/jre/lib/PA_RISC2.0 \
   -L <install_dir>/jre/lib/PA_RISC2.0/server \
      -l imbdfplg

chmod a+r <output_dir>/SwitchNode.lil

Linux에서 컴파일

다음과 같이 지원되는 C 컴파일러를 사용하여 Linux에서 사용자 정의 노드를 컴파일하고 링크하십시오. 행은 읽기 쉽도록 하기 위해 여러 행으로 분리되었습니다. 각 명령을 단일 입력 행에 입력하십시오.

/usr/bin/g++ -c -fpic -MD -trigraphs -I. -I/opt/mqsi/include 
    -I/opt/mqsi/include/plugin -DLINUX -D__USE_GNU 
    -D_GNU_SOURCE TransformNode.c
/usr/bin/g++ -c -fpic -MD -trigraphs -I. -I/opt/mqsi/include 
    -I/opt/mqsi/include/plugin -DLINUX -D__USE_GNU 
    -D_GNU_SOURCE SwitchNode.c /usr/bin/gcc -c -fpic -MD -trigraphs  -I. -I/opt/mqsi/include 
    -I/opt/mqsi/include/plugin -DLINUX -D__USE_GNU 
    -D_GNU_SOURCE BipSampPluginUtil.c 
/usr/bin/g++ -c -fpic -MD -trigraphs -I. -I/opt/mqsi/include 
    -I/opt/mqsi/include/plugin -DLINUX -D__USE_GNU 
    -D_GNU_SOURCE Common.c 
/usr/bin/g++ -c -fpic -MD -trigraphs -I. -I/opt/mqsi/include 
    -I/opt/mqsi/include/plugin -DLINUX -D__USE_GNU 
    -D_GNU_SOURCE NodeFactory.c
/usr/bin/g++ -o samples.lil 
		TransformNode.o SwitchNode.o BipSampPluginUtil.o Common.o NodeFactory.o 
	  -shared -lc -lnsl -ldl -L/opt/mqsi/lib -limbdfplg 
이 명령은 TransformNode 및 SwitchNode 오브젝트를 제공하는 samples.lil 파일을 작성합니다.
변경 시작g++를 사용하여 C 플러그인을 빌드하려면 일부 변경이 필요합니다. 다음과 같이 인터페이스 함수는 C++ 컴파일러에 C 형식 함수로 정의되어야 합니다.
 #ifdef __cplusplus                                                  
   extern "C"{                                                        
   #endif                                                              
   void LilFactoryExportPrefix * LilFactoryExportSuffix bipGetParserFactory()                                               
   {                                                                   
   ...                                                                 
   ...                                                                 
   }                                                                   
   #ifdef __cplusplus                                                  
   }                                                                   
   #endif                                                        
주: 코드를 이식 가능하게 하고 C 컴파일러에서 extern "C" 지시문을 숨기려면 ifdefs가 필요합니다.
변경 끝

Solaris에서 컴파일

다음과 같이 지원되는 C 컴파일러를 사용하여 Solaris에서 사용자 정의 노드를 컴파일하고 링크하십시오.
cc -mt \
   -I. \
   -I<install_dir>/include \
   -I<install_dir>/include/plugin \
      -c SwitchNode.c \
   -o <output_dir>/SwitchNode.o

cc -mt \
   -I. \
   -I<install_dir>/include \
   -I<install_dir>/include/plugin \
      -c BipSampPluginUtil.c \
   -o <output_dir>/BipSampPluginUtil.o

cc -mt \
   -I. \
   -I<install_dir>/include \
   -I<install_dir>/include/plugin \
   -c NodeFactory.c \
   -o <output_dir>/NodeFactory.o

cc -mt \
   -I. \
   -I<install_dir>/include \
   -I<install_dir>/include/plugin \
   -c Common.c \
   -o <output_dir>/Common.o

cc -G \
   -o <output_dir>/SwitchNode.lil \
      <output_dir>/SwitchNode.o \
      <output_dir>/BipSampPluginUtil.o \
      <output_dir>/NodeFactory.o \
      <output_dir>/Common.o \
   -L <install_dir>/lib /
      -l imbdfplg

chmod a+r <output_dir>/SwitchNode.lil

z/OS에서 컴파일

다음과 같이 _CC_STEPS 변수를 -1로 설정하여 링크가 프리링커 또는 링커를 사용하도록 강제 실행하십시오.
export _CC_STEPS=-1
아니면 다음과 같이 이 두 행을 Makefile에 추가하여 내보낼 수 있습니다.
_CC_STEPS=-1
.EXPORT : _CC_STEPS

다음과 같이 지원되는 C 컴파일러를 사용하여 z/OS에서 사용자 정의 노드를 컴파일하고 링크하십시오.

cc -c \
 -Wc,DLL -g -W0,long,langlvl\(extended\),EXPORTALL,TARGET\(OSV2R8\),float\(ieee\) \
 -Wc,xplink \
 -W0,LIST\(./SwitchNode.lst\) \
 -I. -I${install_dir}/include \
 -I${install_dir}/include/plugin \
  -I${install_dir}/sample/include \
  -I${install_dir}/sample/plugin \
 -o ./SwitchNode.o ./SwitchNode.c
cc -c \
 -Wc,DLL -g -W0,long,langlvl\(extended\),EXPORTALL,TARGET\(OSV2R8\),float\(ieee\) \
 -Wc,xplink \
 -W0,LIST\(./SwitchNode.lst\) \
 -I. -I${install_dir}/include \
 -I${install_dir}/include/plugin \
  -I${install_dir}/sample/include \
  -I${install_dir}/sample/plugin \
 -o ./BipSampPluginUtil.o ./BipSampPluginUtil.c
cc -c \
 -Wc,DLL -g -W0,long,langlvl\(extended\),EXPORTALL,TARGET\(OSV2R8\),float\(ieee\) \
 -Wc,xplink \
 -W0,LIST\(./SwitchNode.lst\) \
 -I. -I${install_dir}/include \
 -I${install_dir}/include/plugin \
  -I${install_dir}/sample/include \
  -I${install_dir}/sample/plugin \
 -o ./Common.o ./Common.c
cc -c \
 -Wc,DLL -g -W0,long,langlvl\(extended\),EXPORTALL,TARGET\(OSV2R8\),float\(ieee\) \
 -Wc,xplink \
 -W0,LIST\(./SwitchNode.lst\) \
 -I. -I${install_dir}/include \
 -I${install_dir}/include/plugin \
  -I${install_dir}/sample/include \
  -I${install_dir}/sample/plugin \
 -o ./NodeFactory.o ./NodeFactory.c
cc \
 -Wl,DLL -g  -Wl,p,map -Wl,LIST=ALL,MAP,XREF,REUS=RENT \
 -Wl,xplink \
 -o ./SwitchNode.lil ./SwitchNode.o ./BipSampPluginUtil.o \
 ./Common.o ./NodeFactory.o \
 ${install_dir}/lib/libimbdfplg.x

다음 명령을 실행하여 사용자 정의 확장의 파일 권한을 그룹 읽기 및 실행으로 설정하십시오.

chmod a+rx {output_dir}/SwitchNode.lil
주: 최적화된 빌드를 위해 -g-2가 됩니다.
주의사항 | 등록상표 | 다운로드 | 라이브러리 | 지원 | 피드백
Copyright IBM Corporation 1999, 2006 마지막 갱신 날짜: 2006/08/21
as10000_