AutoSys Workload Automation

Expand all | Collapse all

The Compilation and Linking problem related to JIL EXIT in windows

Jump to Best Answer
  • 1.  The Compilation and Linking problem related to JIL EXIT in windows

    Posted 03-14-2018 02:48 PM

    Hello everyone,

    I watched vedio "CA Workload Automation AE Verification Exit - autoextvj" from Mark_Hanson, and also checked the sample program autoextvj_sample_lib.c from "autosys/code" folder. Currently, I am trying to create and learn a similar program to check valid "group" and "application" attributes, but I failed.

     

    Question 1: 

       In the coding part from the vedio, I found Mark using Callbacks.pfnFindJilKeyVal(pJob, "application")  to get "applicaiton" attribute. So I typed the exatly same code from the vedio into my 2017 Visual Studio, it shows error: 

     

    const char[12]"application", argument of type "const char *" is incompatible with parameter  of type "char *"

     

    According to the provided head file autoextvj.h, it shows:

          

    typedef PAUTOEXTVJ_JILKEYVAL (*pfn_FindJilKeyVal)(PAUTOEXTVJ_JILKEYVAL, char *) 

     

    which means the second parameter in pfnFindJilKeyVal() only has to be char * type, while the parameter value "application" is const char *.

    Therefore, I have to change the original code to Callbacks.pfnFindJilKeyVal(pJob, (char*)"application") to force the "application" as char * type, which is different from the vedio.

    So my first question is:

    How the original code in vedio can pass the compiling stage without even check the different types when it is getting attributes' name?

     

    Question 2:

       The existing vedio only shows how to compile and link the shared library libautoextvj.so to the Autosys in Unix. After I modified (based on the Question 1 logic) the sample code and successfully compiling it, I tried two ways to build libautoextvj.dll in Windows, and move this dll file to the "autosys/bin" folder. 

       The first way is to use the Visual Studio to create a DLL project. I paste the modified code(it is .cpp file not .c file) into this project, including the autoextvj.h. Then the Visual Studio generates the released edition (win32) libautoextvj.dll. After I move this dll file into bin and restart the autosys. The autosys still cannot check the "application" and "group".

       The second way is to use the Windows Terminal to compile and link the sample code. I download the gcc command into Windows terminal, and try to implement the same way from the vedio under the Windows environment. The test1.c is the sample code which is in the Bin folder.

    1.    compile the test.c to object:   gcc -c -fPIC -Wall test1.c -I..\\code -o test1.o
    2.    compile and link to dll:    gcc -shared -fPIC -o libautoextvj.dll test1.o

    In the window, gcc cannot tell -shared[-m32], only can try -shared. For the Linking step I have no idea how to check my dll is 32-bit or 64-bit. After all, it still failed to link to the autosys.

    After the compiling, I am trying to find mistakes in this two ways. If you have any suggestions, I really appreciate your help and time. 

     

    Thank you.



  • 2.  Re: The Compilation and Linking problem related to JIL EXIT in windows
    Best Answer

    Posted 03-14-2018 03:50 PM

    Hi,

    If you have an earlier version of Visual Studio available I recommend trying that. I have run into issues attempting to compile AutoSys API code using newer versions of Visual Studio. IIRC the version I used in the video was VS2010.

    I have not tried compiling using gcc on Windows so I cannot speak to that.

     

    Be sure to build a 32-bit DLL and don't forget to restart the app server after copying the DLL to %AUTOSYS%\bin.

     

    Good luck.

    Mark