Error 193 loading custom application

I created an .MA application and corresponding dll using Visual Studio 14.0.

When launching MicroStation CE version 10.16.00.80, I specify a specific configuration (-wu<config>) on the command line which contains the entry MS_DGNAPPS indicating that my application should be loaded at startup.

Works great.

So far, so good.

On a different PC, I have the very same version of MicroStation but at startup it gives me error 193 (the OS could not load myappl.dll).

I did some googling and this error should indicate that I'm trying to load a 32 bit DLL, which is not true (I checked it with DUMPBIN /HEADERS).

Within MicroStation I tried to load the MDL manually (Ribbon Design/Utilities/MDL applications). It does show me my custom applications but when trying to load one of them, I get the very same error.

I'm quite sure I'm missing something stupid but I can't figure out what it is.

Thanks,

Robert

Parents
  • Hi ,

    MicroStation CONNECT (and respective SDKs) Update 12 thru 16 require Microsoft Visual Studio 2017 (MSVC 14.1) vs. VS2015 (MSVC 14.0). Ref: MicroStation CONNECT SDK Requirements.

    Do you notice the issue if re-compiling with the required VS 2017?

    It is worth noting in the near future when MicroStation CONNECT Update 16.1 releases Microsoft Visual Studio 2019 (MSVC 14.2) will be the default toolset required.

    HTH,
    Bob



  • Hi Robert,

    Thanks for your reply. I'll check it out and be back to you.

    The question is: how come everyting does work on the PC on which I compiled everything? 

  • Hi Jan/Jon,

    First of all, thank you so much for your effort. Though the problem is still not resolved, you're doing everything to help me.

    My target machine:

    Windows 10 Pro, version 21H1, build 19043.1165

    Processor AMD Ryzen 5 5600U, 2.30GHz

    16GB RAM

    Microstation Connect Edition, version 10.16.0.80

    I got the variable $MS point to CE and not to V8i.

    The script that launches MS contains the line:

    start %MS%microstation.exe -wdoracle -wusigra-it %SIGRA%\data\logosigra.dgn

    The %SIGRA% points to the root directory of all my files, including all custom .ma and .dll

    The logo-DGN is opened correctly at startup

    When I rename the dll, putting an underscore in front, I get error "Cannot find myappl.dll" (or something similar, I got the Italian version). So, MS is trying to load the correct dll.

    I double checked by means of the VS utility DUMPBIN and the DLL is actually 64 bit.

    In myappl.r, I defined:

    #define DLLAPP_MYAPPL 1

    DllMdlApp DLLAPP_MYAPPL =
    {
      L"myappl", L"myappl"
    }

    I searched the whole harddisk of the target machine and there's no other file with the same name.

    My development machine:

    Windows 10 Pro, version 20H2, build 19042.1165

    Processor Intel Core i7-10510U, 2.30GHz

    16GB RAM

    Microstation Connect Edition, version 10.16.0.80

     

    Personally, I don't think that the Windows build and/or type of processor make any difference.

    I'm quite sure I made a very stupid error or have overseen something very obvious.....

  • The %SIGRA% points to the root directory of all my files, including all custom .ma and .dll

    What is the definition of MicroStation configuration variable MS_MDLAPPS?

    MS_MDLAPPS

     
    Regards, Jon Summers
    LA Solutions

  • In the user's configuration file, we got, among others, the following entries:

    • MS_SETTINGSDIR = $(SIGRA)/data
    • MS_MDLAPPS < $(SIGRA)/so_nt/apps/italiano
    • MS_LIBRARY_PATH < $(SIGRA)/so_nt/apps/italiano
    • MS_MDL < $(SIGRA)/so_nt/apps/italiano
    • MS_DGNAPPS = myappl

    Where %SIGRA% equals C:\SirenCE

    My CE custom applications are found in C:\SirenCE\so_nt\apps\italiano

    It seems everything is pointing to the correct directories

    • MS_SETTINGSDIR = $(SIGRA)/data
    • MS_MDLAPPS < $(SIGRA)/so_nt/apps/italiano
    • MS_LIBRARY_PATH < $(SIGRA)/so_nt/apps/italiano
    • MS_MDL < $(SIGRA)/so_nt/apps/italiano

    If those are defined in a configuration file, then you must append a slash (/) to each folder path.  Without the trailing slash, MicroStation tries to interpret the value as a file specification.

    MS_SETTINGSDIR = $(SIGRA)/data/
    MS_MDLAPPS < $(SIGRA)/so_nt/apps/italiano/
    MS_LIBRARY_PATH < $(SIGRA)/so_nt/apps/italiano/
    MS_MDL < $(SIGRA)/so_nt/apps/italiano/

    Or, easier to maintain...

    SIGRA_ITALIANO = $(SIGRA)/so_nt/apps/italiano/
    SIGRA_INGLESE = $(SIGRA)/so_nt/apps/english/
    SIGRA_LANGUAGE = $(SIGRA_ITALIANO)
    MS_MDLAPPS < $(SIGRA_LANGUAGE)
    MS_LIBRARY_PATH < $(SIGRA_LANGUAGE)
    MS_MDL < $(SIGRA_LANGUAGE)

     
    Regards, Jon Summers
    LA Solutions

  • Hi Jon,

    In my previous reply I made an error during copy/paste: within the configuration file all directory entries already have a trailing slash.

    By the way, within the reply I manually resolved some environment variables.

    The real entry is:

    MD_MDLAPPS < $(SIGRA)/$(SISTEMA)/apps/$(LINGUAGGIO)/

    Where:

    $(SISTEMA) equals "so_nt" and

    $(LINGUAGGIO) equals "italiano"

  • Where %SIGRA% equals C:\SirenCE

    Given that %SIGRA% should instead equal C:/SirenCE/

    Or, easier to maintain...

    SIGRA_ITALIANO = $(SIGRA)/so_nt/apps/italiano/
    SIGRA_INGLESE = $(SIGRA)/so_nt/apps/english/
    SIGRA_LANGUAGE = $(SIGRA_ITALIANO)
    MS_MDLAPPS < $(SIGRA_LANGUAGE)
    MS_LIBRARY_PATH < $(SIGRA_LANGUAGE)
    MS_MDL < $(SIGRA_LANGUAGE)

    Your suggestions ought to be written as:


    SIGRA_ITALIANO = $(SIGRA)so_nt/apps/italiano/
    SIGRA_INGLESE = $(SIGRA)so_nt/apps/english/
    SIGRA_LANGUAGE = $(SIGRA_ITALIANO)
    MS_MDLAPPS < $(SIGRA_LANGUAGE)
    MS_LIBRARY_PATH < $(SIGRA_LANGUAGE)
    MS_MDL < $(SIGRA_LANGUAGE)

  • Given that %SIGRA% should instead equal C:/SirenCE/

    We don't know.  There may be other reasons why SIGRA — a Windows environment variable — should not have a trailing slash.  The rules of MicroStation configuration variable definition should not be applied to Windows environment variables without testing.

    Your suggestions ought to be written

    I don't know about ought.  They could be written without a slash after $(SIGRA) if that were to be redefined as you advise.

    I made an error during copy/paste: within the configuration file all directory entries already have a trailing slash

    So this discussion is moot.

     
    Regards, Jon Summers
    LA Solutions

  • I'm not sure if it may help, but I hereby attach the output of DUMPBIN /HEADERS /DEPENDENTS of the DLL.

    So far, I've always referred to the DLL as "myappl" while its actual name is "SHD_LIBRARY". It is loaded at startup and exports tons of functions used by other customer applications.

    Its MdlMain, after some general initialization, launches a second application that executes the login procedure.

    Microsoft (R) COFF/PE Dumper Version 14.16.27045.0
    Copyright (C) Microsoft Corporation.  All rights reserved.
    
    
    Dump of file C:\Develop\SIREN-INP\CAD_CE\rilascio\SIGRA-IT\so_nt\wind\apps\italiano\shd_library.dll
    
    PE signature found
    
    File Type: DLL
    
    FILE HEADER VALUES
                8664 machine (x64)
                   6 number of sections
            61250C25 time date stamp Tue Aug 24 17:11:33 2021
                   0 file pointer to symbol table
                   0 number of symbols
                  F0 size of optional header
                2022 characteristics
                       Executable
                       Application can handle large (>2GB) addresses
                       DLL
    
    OPTIONAL HEADER VALUES
                 20B magic # (PE32+)
               14.16 linker version
              1C1000 size of code
             43FFA00 size of initialized data
                   0 size of uninitialized data
              1BB67C entry point (00000001801BB67C) _DllMainCRTStartup
                1000 base of code
           180000000 image base (0000000180000000 to 00000001845C4FFF)
                1000 section alignment
                 200 file alignment
                6.00 operating system version
                0.00 image version
                6.00 subsystem version
                   0 Win32 version
             45C5000 size of image
                 400 size of headers
                   0 checksum
                   2 subsystem (Windows GUI)
                 160 DLL characteristics
                       High Entropy Virtual Addresses
                       Dynamic base
                       NX compatible
              100000 size of stack reserve
                1000 size of stack commit
              100000 size of heap reserve
                1000 size of heap commit
                   0 loader flags
                  10 number of directories
              244830 [    5FA4] RVA [size] of Export Directory
              24A7D4 [     190] RVA [size] of Import Directory
             45C3000 [      F8] RVA [size] of Resource Directory
             45B7000 [    B1E4] RVA [size] of Exception Directory
                   0 [       0] RVA [size] of Certificates Directory
             45C4000 [     7B0] RVA [size] of Base Relocation Directory
              22A770 [      70] RVA [size] of Debug Directory
                   0 [       0] RVA [size] of Architecture Directory
                   0 [       0] RVA [size] of Global Pointer Directory
              22A8E0 [      28] RVA [size] of Thread Storage Directory
              22A7E0 [     100] RVA [size] of Load Configuration Directory
                   0 [       0] RVA [size] of Bound Import Directory
              1C2000 [    1360] RVA [size] of Import Address Table Directory
                   0 [       0] RVA [size] of Delay Import Directory
                   0 [       0] RVA [size] of COM Descriptor Directory
                   0 [       0] RVA [size] of Reserved Directory
    
    
    SECTION HEADER #1
       .text name
      1C0F0D virtual size
        1000 virtual address (0000000180001000 to 00000001801C1F0C)
      1C1000 size of raw data
         400 file pointer to raw data (00000400 to 001C13FF)
           0 file pointer to relocation table
           0 file pointer to line numbers
           0 number of relocations
           0 number of line numbers
    60000020 flags
             Code
             Execute Read
    
    SECTION HEADER #2
      .rdata name
       8E02C virtual size
      1C2000 virtual address (00000001801C2000 to 000000018025002B)
       8E200 size of raw data
      1C1400 file pointer to raw data (001C1400 to 0024F5FF)
           0 file pointer to relocation table
           0 file pointer to line numbers
           0 number of relocations
           0 number of line numbers
    40000040 flags
             Initialized Data
             Read Only
    
      Debug Directories
    
            Time Type        Size      RVA  Pointer
        -------- ------- -------- -------- --------
        61250C25 cv            6F 0022C3BC   22B7BC    Format: RSDS, {E84A2B0D-BB33-4FC4-B598-252FFC915B9B}, 1, C:\Develop\SIREN-INP\cad_ce\rilascio\SIGRA-IT\so_nt\wind\apps\italiano\shd_library.pdb
        61250C25 feat          14 0022C42C   22B82C    Counts: Pre-VC++ 11.00=0, C/C++=118, /GS=118, /sdl=85, guardN=33
        61250C25 coffgrp      338 0022C440   22B840    4C544347 (LTCG)
        61250C25 iltcg          0 00000000        0
    
      Image has the following dependencies:
    
        KERNEL32.dll
        USER32.dll
        OCI.dll
        USTATION.dll
        Bentley5.dll
        BentleyAllocator.dll
        DgnPlatform5.dll
        RmgrTools3.dll
        BentleyGeom5.dll
        MSVCP140.dll
        VCRUNTIME140.dll
        api-ms-win-crt-string-l1-1-0.dll
        api-ms-win-crt-convert-l1-1-0.dll
        api-ms-win-crt-stdio-l1-1-0.dll
        api-ms-win-crt-heap-l1-1-0.dll
        api-ms-win-crt-runtime-l1-1-0.dll
        api-ms-win-crt-time-l1-1-0.dll
        api-ms-win-crt-environment-l1-1-0.dll
        api-ms-win-crt-math-l1-1-0.dll
    
    SECTION HEADER #3
       .data name
     4365B38 virtual size
      251000 virtual address (0000000180251000 to 00000001845B6B37)
        2800 size of raw data
      24F600 file pointer to raw data (0024F600 to 00251DFF)
           0 file pointer to relocation table
           0 file pointer to line numbers
           0 number of relocations
           0 number of line numbers
    C0000040 flags
             Initialized Data
             Read Write
    
    SECTION HEADER #4
      .pdata name
        B1E4 virtual size
     45B7000 virtual address (00000001845B7000 to 00000001845C21E3)
        B200 size of raw data
      251E00 file pointer to raw data (00251E00 to 0025CFFF)
           0 file pointer to relocation table
           0 file pointer to line numbers
           0 number of relocations
           0 number of line numbers
    40000040 flags
             Initialized Data
             Read Only
    
    SECTION HEADER #5
       .rsrc name
          F8 virtual size
     45C3000 virtual address (00000001845C3000 to 00000001845C30F7)
         200 size of raw data
      25D000 file pointer to raw data (0025D000 to 0025D1FF)
           0 file pointer to relocation table
           0 file pointer to line numbers
           0 number of relocations
           0 number of line numbers
    40000040 flags
             Initialized Data
             Read Only
    
    SECTION HEADER #6
      .reloc name
         7B0 virtual size
     45C4000 virtual address (00000001845C4000 to 00000001845C47AF)
         800 size of raw data
      25D200 file pointer to raw data (0025D200 to 0025D9FF)
           0 file pointer to relocation table
           0 file pointer to line numbers
           0 number of relocations
           0 number of line numbers
    42000040 flags
             Initialized Data
             Discardable
             Read Only
    
      Summary
    
         4366000 .data
            C000 .pdata
           8F000 .rdata
            1000 .reloc
            1000 .rsrc
          1C1000 .text
    

  • Image has the following dependencies

    Are those DLLs all present on the non-working computer? 

     
    Regards, Jon Summers
    LA Solutions

  • I hardly dare to admit, but I forgot to install the 64bit version of the oracle client.

    Things are workly correctly now.

    Thank you so much and sorry I wasted your time.

    Answer Verified By: Robert Hook 

Reply Children