Transports and Interfaces: Siebel Enterprise Application Integration > EAI DLL and EAI File Transports > About the EAI DLL Transport >

Creating a DLL to Call a Function in an External DLL


The following procedure illustrates how to create a DLL to use the EAI DLL Transport business service to call a function in an external DLL.

Starting in release 7.5.3, it is not necessary for the DLL to release the memory either on Microsoft Windows or UNIX. The DLL transport business service will release the memory. If the DLL does a memory deallocation, it will most likely crash. The basic assumption is that the DLL must do the memory allocation with a C-style malloc only. Any other type of allocation will not be handled properly and may even lead to crashes.

To create a DLL

  1. Open a VC++ project by choosing the Open menu, then New.
  2. Select a Win32 Dynamic Link Library and give the name of the project.
  3. In the next dialog box, select the option Simple dll project.

    Following files are created by default:

    • Project.cpp
    • StdAfx.h
    • StdAfx.cpp
  4. Make the following changes in the StdAfx.h and Main.cpp files and check the results in the process simulator:

    StdAfx.h

    struct XMLDataBuf

    {

    int       nLength;

    void*     pData;

    };

    extern "C" int __declspec(dllexport) TestEAI(const XMLDataBuf* Value, XMLDataBuf* pReply);

    Main.cpp

    #include "stdafx.h"

    #include <string.h>

    #include <stdio.h>

    #include <io.h>

    BOOL APIENTRY DllMain( HANDLE hModule,

                           DWORD ul_reason_for_call,

                           LPVOID lpReserved

                                           )

    {

       return TRUE;

    }

    extern "C" int __declspec(dllexport) TestEAI(const XMLDataBuf* Value, XMLDataBuf* pReply)

    {

          FILE *p;

          p = fopen("c:\\test.txt","w");

          fprintf(p,"before test");

          fprintf(p,"%s After Test",Value->pData);

       //strcpy(s,"Hello World");

       fclose(p);

          return 0;

    }

Transports and Interfaces: Siebel Enterprise Application Integration Copyright © 2011, Oracle and/or its affiliates. All rights reserved. Legal Notices.