Liquid XML Data Binder (C++, Java, VB6) / Reference / C++ / Key Concepts / Building Projects / C++ Building XML projects (Windows)
In This Topic
    C++ Building XML projects (Windows)
    In This Topic

    First, generate your library from your XML Schema. This generates all project, header and source files required. You can then create a new C++ project for your application using Microsoft Visual Studio.

    Using a shared CRT
    This demonstrates how to prevent heap asserts when objects are cleaned up. (See also GPF when using strings ).
    In debug the CRT keeps track of all the memory it allocated, when memory is deleted it checks to see it actually allocated it. If it didn't it asserts. If you link your project statically against the CRT lib (/ML, /MLd, /MT, /MTd), then the dll, and the exe have their own version of the CRT, and thus 2 lists of memory that have been allocated. A problem arises if memory is allocated in one and freed in another. Linking against the shared CRT DLL (/MD,/MDd) solves this problem.

    Change C++ Compiler Options
    For an Exe
    Debug - /MLd to /MDd
    Release - /ML to /MD

    For a Dll
    Debug - /MTd to /MDd
    Release - /MT to /MD

    Also you will need to Enable Run-Time Type Information (RTTI):
    Add the /GR compile option to all builds

    Linking to your Library
    In order to use the generated code you must link to it, and also to our runtime library. This section describes the libraries you must link to and the library paths that need setting up.
    NOTE: When you build your library from the generated code, Visual Studio defaults to Static Debug as Active Configuration.

    Include Files
    Your new project needs access to the standard header files we distribute, and the header files that you generated (when you ran the wizard).
    Ensure visual studio can see the following can see the include paths
    [Liquid Technologies install dir]\XmlDataBinder20\Redist20\cpp\include
    [The path where you generated you XML Binding Library to]

    The build version you require further depends on the C Runtime version that your compiler is using. The 32 bit dll files are found in the 'Redist20\cpp\win32\bin' folder and corresponding lib files in the 'Redist20\cpp\win32\lib' folder, and the 64 bit dll files are found in the 'Redist20\cpp\win64\bin' folder and corresponding lib files in the 'Redist20\cpp\win64\lib' folder.

    The Liquid Runtime libraries for Windows use the following naming convention:

    Release libraries: LtXmlLib20_vcVV.dll

    Debug Libraries: LtXmlLib20D_vcVV.dll

    Unicode Release libraries: LtXmlLib20U_vcVV.dll

    Unicode Debug Libraries: LtXmlLib20UD_vcVV.dll

    64 bit libraries: LtXmlLib20_vcVVx64.dll

    XP specific libraries: LtXmlLib20_vcVV_xp.dll

    Where VV is the C++ version you are using.


    A 32 bit non-Unicode Release library using C++ 14.1 would look like:


    Whereas a 64 bit Unicode Debug library using C++ 14.1 specifically for XP would look like:


    These are all C++ dynamic link libraries and have the following namespace:


    Your generated component, and possibly your client, should reference this file.

    Static Linking
    The C++ generated code has Static Build configurations, to use these:

    1. Select the generated library in Visual Studio and select one of the Static Configurations:
      1. Static Debug
      2. Static Unicode Debug
      3. Static Release
      4. Static Unicode Release
    2. Add a preprocessor directive to the SampleApp to show static linkage is required:
      1. Open SampleApp Properties
      2. Select C++ Preprocessor options
      3. Change Preprocessor Definitions by adding an entry that matches the name of the generated library
        e.g. WIN32;_DEBUG;_CONSOLE;myGeneratedLib_STATIC
    3. Manually call the Register method

    Please note, static runtime libraries are not included, if you need to avoid distributing the Liquid Runtime DLL, you would need to purchase the C++ Source Code and build the runtime yourself with /MT.

    Running the code
    Your new project needs access to the standard Liquid Technologies Runtime dll, and the dll that you compiled from the new XML Data Binding component you just generated.