Uniface User Forum

 View Only
  • 1.  Unable to load 3rd party dll - error 193

    Posted 11-30-2023 19:22

    In the process of testing one of our Uniface apps under upgraded version 10.4, I received the following error message:

    Unable to load useqread.dll; error 193 ('System or I/O error 193 occurred.')

    The dll is listed in the [USER_3GL] section of the assignment file and the app works fine in version 10.3.

    Any idea as to what might be happening?

    Thank you.



    ------------------------------
    Jim Mitchell
    State of Oregon
    Salem OR US
    ------------------------------


  • 2.  RE: Unable to load 3rd party dll - error 193

    Posted 12-04-2023 11:19

    Hi Jim,

    Could you have an architecture mismatch, i.e. 32bit and 64bit?  The DLLs and Uniface need to be the same.

    Kind regards,

    Mike



    ------------------------------
    Michael Taylor
    Rocket Internal - All Brands
    ------------------------------



  • 3.  RE: Unable to load 3rd party dll - error 193

    Posted 12-04-2023 12:16

    Hi Michael,

    Yes, that's likely the problem. This version, we're attempting to go to 64-bit IDE. Although, runtime has been 64-bit for a while so I'm not sure why this didn't fail in the last upgrade we did.

    Anyway, it looks like our options are to either get updated source for the useqread function (author is Ulrich Merkel of Compuware Services, created over 20 years ago)  or eliminate the dll altogether by redoing the code to use the ProcScript statement fileload. Not sure why the dll was used in the first place; that was done way before I was the Uniface administrator.

    Does anyone else use the useqread.dll and know if there is an updated version? If not, I'll go with Plan B.

    Thank you Michael.



    ------------------------------
    Jim Mitchell
    State of Oregon
    Salem OR US
    ------------------------------



  • 4.  RE: Unable to load 3rd party dll - error 193

    Posted 09-19-2024 15:27

    Hi James,

    I'm curious as to if you ever solved this issue. We have code using this older DLL as well, and we do need to migrate it at some point. Any luck with "fileload"? You can read TXT/CSV files using those connectors, but you I believe you're stuck with how you can specify the path (must be a static path, not dynamic or selectable at runtime).

    I did however find this old post with what I believe is the source-code of that DLL:Uniface Wishes: Struct like complex data type for SQL results set | Uniface User Forum (rocketsoftware.com)

    I went and copied/pasted the ProcScript and C code and I was able to pull out the following code below. Not sure if this helps you or your team, but this might get you somewhere?

    Joe

    C Code:

    char listsep;
    char nam_fpi[_MAX_PATH];
    char workbuffer[8001];
    long rec_cnt;
    FILE * fpi; /* ***************************** Exported functions */
    XEXPORT(long) GETTICKS(void) {
      return (GetTickCount());
    }
    XEXPORT(long) M4LS_INFO(void) /* returns name of file and record count */ {
      UPUTREGS(30, nam_fpi);
      return (rec_cnt);
    }
    XEXPORT(long) M4LS_OPEN(void) /* opens the file for reading and sets parameters*/ {
      UGETREGS(30, nam_fpi, sizeof(nam_fpi) - 1); /* Input File */
      UGETREGS(31, workbuffer, sizeof(workbuffer) - 1); /* Separator */
      listsep = workbuffer[0];
      if (nam_fpi[0] == 0) {
        UPUTREGS(30, "M4LS_E0001 Input file has to be specified");
        return (-11);
      };
      if ((fpi = fopen(nam_fpi, "rt")) == NULL) {
        UPUTREGS(30, "M4LS_E0002 can't open input file");
        rec_cnt = -11;
        return (-2);
      }
      rec_cnt = 0;
      return (rec_cnt);
    }
    XEXPORT(long) M4LS_CLOSE(void) /* closes the file and frees the buffers */ {
      if (fclose(fpi) == EOF) {
        UPUTREGS(30, "M4LS_E0003 can't close input file");
        return (-5);
      };
      rec_cnt = -2;
      return (0);
    }
    XEXPORT(long) M4LS_NEXT(void) /* copies next record to $30*/ {
      char * p;
      if (fgets(workbuffer, sizeof(workbuffer) - 1, fpi) == NULL) /* read a record */ return (-3);
      for (p = workbuffer;* p != ''; p++)
        if ( * p == '\n') * p = '';
      if (listsep != '')
        for (p = workbuffer;* p != ''; p++)
          if ( * p == listsep) * p = '\33';
      UPUTREGS(30, workbuffer);
      return (++rec_cnt);
    }
    XEXPORT(long) M4LS_RULER2LIST(void) /* sets SEPARATORS in data where a LISTSEP character is encountered in RULER string */ {
      char L_DATA[8001];
      char L_RULER[8001];
      char L_LISTSEP[2];
      char * p_data;
      char * p_ruler;
      UGETREGS(30, L_DATA, sizeof(L_DATA) - 1); /* Data String */
      UGETREGS(31, L_RULER, sizeof(L_RULER) - 1); /* Ruler String */
      UGETREGS(32, L_LISTSEP, sizeof(L_LISTSEP) - 1); /* Separator Character in Ruler string */
      if (L_LISTSEP[0] == 0) L_LISTSEP[0] = ' ';
      for (p_data = L_DATA, p_ruler = L_RULER;* p_data != ''; p_data++, p_ruler++)
        if ( * p_ruler == L_LISTSEP[0]) * p_data = '\33';
      UPUTREGS(30, L_DATA); /* Data String */
      return (0);
    }
    XEXPORT(long) M4LS_HEADER2LIST(void) /* sets SEPARATORS in data where SPACE changes to non-space in HEADER string */ {
      char L_DATA[8001];
      char L_HEADER[8001];
      char * p_data;
      char * p_header;
      char * p_header_prev;
      UGETREGS(30, L_DATA, sizeof(L_DATA) - 1); /* Data String */
      UGETREGS(31, L_HEADER, sizeof(L_HEADER) - 1); /* Header String */
      for (p_data = L_DATA, p_header_prev = L_HEADER, p_header = L_HEADER, p_header++;* p_header != '' && * p_data != ''; p_data++, p_header_prev++, p_header++)
        if ( * p_header_prev == ' ' && * p_header != ' ') * p_data = '\33';
      UPUTREGS(30, L_DATA); /* Data String */
      return (0);
    }

    ProcScript Entries

    entry do_gen_SQL 
    params 
    string p_DMLTEXT : IN ; SQL Statement 
    string p_SQLPATH : IN ; Uniface Path 
    string p_DUMPPATH: IN ; Path for dumpfile 
    endparams 
    sql/print p_DMLTEXT, p_sqlpath 
    filedump $result,p_dumppath 
    return(0) 
    end ; do_gen_SQL 
     
    entry do_split_SQL 
    params 
    string p_DUMPPATH: IN ; Path for dumpfile 
    string p_Splitted: OUT ; Splitted result 
    endparams 
    variables 
    string v_rec_header, v_rec_ruler, v_rec_data 
    numeric v_loop 
    endvariables 
    p_splitted = "" ; open file, read the header and "ruler" line 
    $30 = p_DUMPPATH 
    $31 = "" 
    perform "M4LS_OPEN" 
    $30 = "" 
    perform "M4LS_NEXT" 
    v_rec_header = $30 
    $30 = "" 
    perform "M4LS_NEXT" 
    v_rec_ruler = $30 
    $30 = v_rec_header 
    $31 = v_rec_header 
    $32 = " " 
    perform "M4LS_HEADER2LIST" 
    p_splitted = $concat(p_splitted,v_rec_header,"%%^",$30,"%%^********%%^") ; read a couple of data lines; convert them to list according to ruler 
    v_loop = 5 
    while (v_loop > 0) 
    v_loop -= 1 
    $30 = "" 
    perform "M4LS_NEXT" 
    if ($status < 0) 
    break 
    endif 
    v_rec_data = $30 
    $30 = v_rec_data 
    $31 = v_rec_header 
    $32 = " " 
    perform "M4LS_HEADER2LIST" 
    p_splitted = $concat(p_splitted,v_rec_data,"%%^",$30,"%%^********%%^") 
    endwhile 
    return(0) 
    end


    ------------------------------
    Joe Baumgartner
    Coordinator, Administrative Systems
    Brandon University
    Brandon CA
    ------------------------------



  • 5.  RE: Unable to load 3rd party dll - error 193

    Posted 09-19-2024 18:06

    Hi Joe,

    I went with plan B, replacing the dll with Uniface proc code (fileload). In some cases, the code was already there and just commented out because of the call to the dll but in other cases, I had to code it from scratch. The Uniface code is slightly slower than using the dll but not enough to make a difference.

    One benefit of ditching the dll is that, because it is a 3rd party component, there is an inherent security risk if it isn't kept up-to-date. This one was especially old so it was good to eliminate it.

    Thank you anyway for the code you provided.



    ------------------------------
    James Mitchell
    State of Oregon
    Salem OR US
    ------------------------------



  • 6.  RE: Unable to load 3rd party dll - error 193

    Posted 09-20-2024 05:41

    Hi Joe

    Why are you using PERFORM?
    Use a C-signature instead :-)

    Ingo



    ------------------------------
    Ingo Stiller
    Aareon Deutschland GmbH
    ------------------------------



  • 7.  RE: Unable to load 3rd party dll - error 193

    Posted 09-20-2024 09:33

    In this particular case, we still have some stuff in Uniface 9.7 which we are trying to move away from. At the time that this code was written, we knew about perform and just used that. I did learn about using C-signatures and activate just the other day, but I'd like to avoid a 3GL interface for this. The code that I did find does not really meet modern compiler standards, so I'd rather use something native.

    Thankfully, this post post helped solve my problem and provides a much cleaner solution than using the old un-maintained DLL.



    ------------------------------
    Joe Baumgartner
    Coordinator, Administrative Systems
    Brandon University
    Brandon CA
    ------------------------------