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 Reply Children
  • Hi Robert.

    I was wrong when I said I compile with VS 14.0. It appears to be VS 2019 version 14.16.27023.

    Does that make any difference?

    Below find the installed versions on the PC that works (the first image) and the one that does not work (the 2nd).

  • Below find the installed versions on the PC that works (the first image) and the one that does not work (the 2nd)

    The working computer has a later version (14.29.30038) of the Microsoft C++ redistributable library.

    How do you install your app?  Using XCopy or a genuine installer such as Lindersoft SetupBuilder?  You should ensure that the target computer is updated with the same version of the C++ redistributable library as your development computer.

     
    Regards, Jon Summers
    LA Solutions

  • Hi Robert,

    I was wrong when I said I compile with VS 14.0. It appears to be VS 2019 version 14.16.27023.

    Visual Studio 2019 is not supported (but will be in CE Update 16.1). You have to use Visual Studio 2017.

    There is a way, how to use VS2019, but it requires to be MSVC and Visual Studio guru to ensure the right toolset (MSVCRT verison) is used, and also modification of mki file(s) is necessary. Probably there is no serious reason why to choose such way.

    Below find the installed versions on the PC that works

    I agree with Jon the problem is caused probably by wrong (or missing) version of MSVCRT. When the right tools are used, the problem does not exist, because both MicroStation and Visual Studio compiler use the same MSVCRT.

    Below find the installed versions on the PC

    I can see you use MicroStation SDK CE U14 with MicroStation CE U16. Are you serious about such development style?

    For every MicroStation version, proper SDK version was released. Exceptions existed, but it's not the case of U16, where SDK CE U16 is available.

    When you prefer to use C++ to create native applications for MicroStation, to follow strict rules about used tools and their versions is mandatory. Otherwise the result is not predictable and unstable. To combine some version of MicroStation with another SDK, in parallel to unsupported Visual Studio version, just cannot lead to robust result.

    With regards,

      Jan

  • When creating my development environment, I simply installed the latest version of VS. I'll try to uninstall VS2019 and install VS2017.

    MS CE Update 16 was installed when the Connection Client suggested me to do so. I didn't know about SDK update 16.

    I'll start from scratch and see what happens.

    Thank you so far

  • I got various versions of Windows SDK on my PC. Can I simply uninstall them after having uninstalled VS 2019? Does the installation of VS 2017 include the correct version of Windows SDK?

    Thanks,

  • I got various versions of Windows SDK on my PC. Can I simply uninstall them after having uninstalled VS 2019? Does the installation of VS 2017 include the correct version of Windows SDK?

    Those are questions for a Microsoft support site.  We're happy to advise about MicroStation development on this Forum, and there are many more people on other Forums who like to discuss Viz Studio and the Windows SDK.

     
    Regards, Jon Summers
    LA Solutions

  • Hi Robert,

    When creating my development environment, I simply installed the latest version of VS.

    honestly, I do not understand the logic. When I want to develop anything in any language, using any tool, the first thing is to check and follow prerequisites exactly (regardless it's MicroStation using C++ or iTwin.js using TypeScript). It's never like "just to install the latest version", even in a case of such flexible environment like NET ... and especially not in the case of C/C++, famous because of problems with MSVCRT versions and "dll hell".

    I'll try to uninstall VS2019 and install VS2017.

    There is no reason to uninstall VS2019, when used for another projects. I typically have 2 or 3 versions installed in parallel, of course not as full installations (because it does not makes sense and consumes too much space), but in configurations containing what I need for active projects.

    Because I use VS2019 for all NET development, I typically use it as editor for C++ code also. When such code is compiled using bmake, VS2017 (C++ compiler/linker) is used automatically, so no compatibility problem exists.

    MS CE Update 16 was installed when the Connection Client suggested me to do so.

    It's automatic, no exceptions: When new MicroStation version is installed and you want to develop application for such version, you have to reinstall SDK also.

    When new MicroStation or MicroStation SDK is released, it's announced in MicroStation Announcements forum, so there is no obstacle to be informed when a pair Microstation + SDK is available.

    I'll start from scratch and see what happens.

    When new MicroStation SDK is installed, it's always recommended to try to compile (all) delivered examples and to test some, to test everything is installed and set correctly.

    I got various versions of Windows SDK on my PC. Can I simply uninstall them after having uninstalled VS 2019?

    It's up to you, whether you need them or not.

    Does the installation of VS 2017 include the correct version of Windows SDK?

    I am not sure what do you mean by "correct version of Windows SDK". "Correct" for what? If you mean "for MicroStation", I recommend to check SDK release announcement, where required VS parts are mentioned, Also, what is necessary from Visual Studio installation was discussed several times in this forum, so use search.

    When you need any specific version of Windows SDK for other project than MicroStation, it makes sense to install it independently from Microsoft archive, because Windows SDK is independent completely. Visual Studio should be able to recognize the installation automatically (even when maybe does not work when the latest SDK and old VS combination is used).

    Regards,

      Jan

  • I'm mainly a Java programmer in a Unix environment and not used to the strict dependencies of Windows and/or C++.

    You're never too old to learn

  • I'm mainly a Java programmer

    In such context, to use C# would be "more friendly way" because of many similarities with Java. But, in MicroStation, NET API is a bit more limited than C++ (but no so much), on the other hand it offers WPF GUI, rich environment and one from the best dev tools available.

    in a Unix environment and not used to the strict dependencies of Windows and/or C++.

    Yes,that's often discussed question why Microsoft did not use some concept from shared libraries and other ideas, known at the time, when dlls were invented.

    Fortunately, because C++ has been back in a main Microsoft focus for last few years, and is developed actively now (including ISO standardization), new MS C++ compilers and MSVCRTs solve the compatibility problem partially. Technically it's possible now to use VS2019 to compile native dll exactly as it was in VS2017, maintaining compatibility, but it requires good knowledge how the system works.

    But in the case of MicroStation, when you do not want to invest time into own research and creating own environment, leading to maybe correct and compatible result, but still not supported officially, it's simpler to use standard supported tools (including bmake, which a lot of people do not like, but that does a lot of tasks and settings automatically).

    You're never too old to learn

    Tell me about it :-) My recent trip from "always desktop" to "web systems" and learning things like Node.js, JavaScirpt, TypeScript and some popular frameworks is just challenging :-))))

    Regards,

      Jan

  • OK, I uninstalled VS 2019 and installed VS 2017. Made the necessary changes in the *.vcxproj file and recompiled everything.

    Made sure that the various installations on the source and target machines are perfectly aligned.

    Unfortunately, I get the very same result: error 193 when loading my application.

    I got 1 very serious doubt: on my target machine I have also MicroStation V8i SS10 installed (for legacy reasons; we're still porting everything). Could that influence the behaviour?

    Thanks again,

    Robert