3 Replies Latest reply: Jun 9, 2014 9:23 AM by Todd Little-Oracle RSS

    How to bulid a Tuxedo client in VS2010

    4bc8f5e6-0b25-41ee-8d93-f8a34fa2ec53

      hello , I'm a noviciate for tuxedo. I just build the TOUPPER sample in simpapp , and I got the right output,like "Returned string is:ABCD". When I decide to bulid my own client in VS2010(), I add the LIB path of tuxedo in the linker->general->additional library  directories,and  add "libtux.lib, libwsc.lib, libbuft.lib, libfml.lib, libfml32.lib, libengine.lib, wtuxws32.lib, wsock32.lib" in linker->input->additional dependency,add the INCLUDE path in the C/C++ ->general ->additional include directories. Now i can build the main.c correctly,but it runs failure with tperrno = 12 and tpcall return code = -1. However when I compile the main.c using buildclient command , it works fine and the output is correct., so I think the reason maybe the configuration of my project in VS2010.  Is there any lib or other step that I do not add?Thank you.

      here is my source code ,main.c:

      #include <stdio.h>
      #include <memory.h>
      #include <stdlib.h>
      #include <atmi.h>
      #include <string.h>
      #include<winsock2.h>
      
      
      char* toupperFunction(char *inputStr)
      {
        char *sendbuf, *rcvbuf;
        long sendlen, rcvlen;
        int ret;
      
      
        if((sendbuf = (char *) tpalloc("STRING", NULL, sendlen+1)) == NULL) {
        (void) fprintf(stderr,"Error allocating send buffer\n");
        tpterm();
        exit(1);
        }
      
      
        if((rcvbuf = (char *) tpalloc("STRING", NULL, sendlen+1)) == NULL) {
        (void) fprintf(stderr,"Error allocating receive buffer\n");
        tpfree(sendbuf);
        tpterm();
        exit(1);
        }
      
      
        (void) strcpy(sendbuf,inputStr);
      
      
        /* Request the service TOUPPER, waiting for a reply */
        ret = tpcall("TOUPPER", (char *)sendbuf, 0, (char **)&rcvbuf, &rcvlen, (long)0);
      
      
        printf("%d",tperrno);//12
      
      
        getchar();
        if(ret == -1) {
        tpfree(sendbuf);
        tpfree(rcvbuf);
        tpterm();
        exit(1);
        }
      
      
        /* Free Buffers & Detach from System/T */
        tpfree(sendbuf);
        tpfree(rcvbuf);
        tpterm();
      
      
        return rcvbuf;
      }
      
      
      int main()
      {
        char* input = "abcd";
        char* output = "";
        output = toupperFunction(input);
        printf("%s",output);
        getchar();
        return 0;
      }
      
      
      
        • 1. Re: How to bulid a Tuxedo client in VS2010
          Todd Little-Oracle

          Hi,

           

          You can see all the necessary libraries and compilation switches needed by invoking buildclient with the -v switch.  It will then print out the exact command line it is using to build your client.  You then just need to make sure your project settings match what buildclient is using.

           

          Regards,

          Todd Little

          Oracle Tuxedo Chief Architect

          • 2. Re: How to bulid a Tuxedo client in VS2010
            4bc8f5e6-0b25-41ee-8d93-f8a34fa2ec53

            Hi

            Thank you for your advice. What I have added in VS2010 properties was based on the command line, just like the INCLUDE PATH, LIB PATH and the their name.I wonder what is missing leading to the unsuccessful running.Here is the command line:

            F:\src64\simpapp>buildclient -o main -f main.c -v
            cl /MD  -I"%TUXDIR%"\include -Femain  main.c   "%TUXDIR%"\lib\libtux.lib  "%TUXD
            IR%"\lib\libbuft.lib  "%TUXDIR%"\lib\libfml.lib "%TUXDIR%"\lib\libfml32.lib "%TU
            XDIR%"\lib\libengine.lib  wsock32.lib kernel32.lib advapi32.lib user32.lib gdi32
            .lib comdlg32.lib winspool.lib   -link -implib:BC-d88.lib
            Microsoft (R) C/C++ Optimizing Compiler Version 16.00.30319.01 for x64
            Copyright (C) Microsoft Corporation.  All rights reserved.
            
            
            main.c
            f:\src64\simpapp\main.c(13) : warning C4700: uninitialized local variable 'sendl
            en' used
            Microsoft (R) Incremental Linker Version 10.00.30319.01
            Copyright (C) Microsoft Corporation.  All rights reserved.
            
            
            /out:main.exe
            -implib:BC-d88.lib
            main.obj
            F:\Oracle\tuxedo11\lib\libtux.lib
            F:\Oracle\tuxedo11\lib\libbuft.lib
            F:\Oracle\tuxedo11\lib\libfml.lib
            F:\Oracle\tuxedo11\lib\libfml32.lib
            F:\Oracle\tuxedo11\lib\libengine.lib
            wsock32.lib
            kernel32.lib
            advapi32.lib
            user32.lib
            gdi32.lib
            comdlg32.lib
            winspool.lib
            
            • 3. Re: How to bulid a Tuxedo client in VS2010
              Todd Little-Oracle

              When you build with Visual Studio, what does the build log look like?

               

              Regards,

              Todd Little

              Oracle Tuxedo Chief Architect