IBM Sterling Transformation Extender

Sterling Transformation Extender

Come for answers, stay for best practices. All we're missing is you.


#Sterling
#Supplychain
 View Only
  • 1.  Library method of the EXIT function

    Posted 04/29/07 03:30 PM

    Originally posted by: SystemAdmin


    Hi,

    I want use the library method of the EXIT function on the platform Windows XP. But when I run the map containing a rule where I call the function stringlength of the library WCD.dll:
    =EXIT("WCD.dll", "stringlength", "Just Another WTX Mapper!")
    I got no response from the Map Designer and I must shutdown the application.

    This method called from an other program written in C works fine. Here's an sample output:codeInput to DLL: Just Another WTX Mapper!
    Message from DLL: Successful completion
    Length of input: 24[/code]
    My software/development configuration:
    Windows XP SP2
    Eclipse 3.2.2 -> Managed Make C Project
    Build as Shared Library (Gnu on Windows)
    WTX Design Studio 8.1 Build 11

    The coding:
    dllsample.c:code#include <string.h>
    #include <stdlib.h>
    #include <stddef.h>
    #include <stdio.h>
    #include <windows.h>
    #include <windowsx.h>
    #include "dllsample.h"
    #include "exitparm.h"

    void stringlength (LPEXITPARAM lpep) {

    lpep->lpDataFromApp = GlobalAllocPtr(GMEM_FIXED, 1024);

    sprintf (
    lpep->lpDataFromApp,
    "%d",
    strlen(lpep->lpDataToApp)
    );

    lpep->dwFromLen = strlen (lpep->lpDataFromApp);
    lpep->nReturn = 0;
    strcpy (lpep->szErrMsg, "Successful completion");
    }[/code]
    exitparm.h:
    code
    #ifndef EXITPARAM_H_
    #define EXITPARAM_H_

    #include <windef.h>

    #ifdef _WIN32
    #define HUGE
    #endif

    struct tagExitParamStruct {
    DWORD dwSize;
    DWORD dwToLen;
    DWORD dwFromLen;
    DWORD dwMapInstance;
    void FAR * lpv;
    LPSTR lpszCmdLine;
    BYTE HUGE * lpDataToApp;
    BYTE HUGE * lpDataFromApp;
    UINT uRetryCount;
    UINT uRetryInterval;
    BOOL bRollback;
    BOOL bCleanup;
    int nReturn;
    char szErrMsg 100;
    char szFile260;
    void FAR * lpMapHandle;
    void FAR * lpInternal;
    void FAR * lpCmdStruct;
    void FAR * lpAdaptParms;
    void FAR * lpContext;
    void FAR * lpWildcard;
    void FAR * lpfnMS;
    void FAR * lpMS;
    DWORD dwWildcardSize;
    LPSTR lpszMapDirectory;
    WORD wCardNum;
    WORD wCleanupAction;
    WORD wScope;
    UINT uUnitSize;
    BOOL bBurst;
    BOOL bFromRule;
    BOOL bSource;
    DWORD dwRecords;
    };

    typedef struct tagExitParamStruct EXITPARAM;
    typedef struct tagExitParamStruct FAR * LPEXITPARAM;

    #endif /*EXITPARAM_H_*/[/code]
    dllsample.h:code#ifndef DLLSAMPLE_H_
    #define DLLSAMPLE_H_

    #include "exitparm.h"
    void stringlength(LPEXITPARAM lpep);

    #endif /*DLLSAMPLE_H_*/[/code]
    Any hints?
    Thanks in advance.

    Andreas
    #DataExchange
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender


  • 2.  Re: Library method of the EXIT function

    Posted 05/01/07 06:53 AM

    Originally posted by: LewS


    Hi,

    Try adding in the WIN32 CALLBACK and EXPORT signatures for the stringlength function... That is:

    void CALLBACK EXPORT stringlength (LPEXITPARAM lpep) {

    This changes the calling convention between your DLL and the TX engine. You will want to do this in both your .c file and the .h file that has the protoype.

    -lew
    #IBM-Websphere-Transformation-Extender
    #DataExchange
    #IBMSterlingTransformationExtender


  • 3.  Re: Library method of the EXIT function

    Posted 05/02/07 06:56 AM

    Originally posted by: SystemAdmin


    Hi Lew,

    thank you for your help.
    I added the EXPORT signature and the #define statement to the function:
    code#ifdef _WIN32
    #define EXPORT __declspec(dllexport)
    #endif[/code]
    ...and some hours later I changed the IDE to MS Visual C++
    ...and it worked.

    Andreas
    #DataExchange
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender