ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / Managing external languages / C language
  • Overview
  • Managing the objects in C
  • Migrating a WINDEV 5.5 application that supports objects in C
  • Managing data files in C or C++
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
I was using C with WINDEV 5.5. How to proceed in WINDEV 2024?
Overview
You have the ability to use external languages with WINDEV. For more details on the different ways to use elements developed in WINDEV with an external language, see external languages in WINDEV.
This paragraph presents the operations that must be performed to migrate a WINDEV 5.5 application that uses C to WINDEV 2024.
Several cases must be considered:
  • managing the objects in C
  • managing HFSQL data files in C or C++
Remarks:
  • Important: The DDE calls (via CallDDE) in 16-bit mode are no longer available in this version of the external interface.
  • New: The CallWD function of the external interface now supports a syntax identical to the one of nWDExecute. This allows you to pass in a parameter to this function a string containing a standard WLanguage code, without using the former syntax such as "SCREEN,INPUT".
Managing the objects in C

Migrating a WINDEV 5.5 application that supports objects in C

To migrate a WINDEV 5.5 application that supports objects in C:
  1. Migrate your WINDEV 5.5 project to WINDEV 7.5, then open it with WINDEV 2024.
  2. Copy the WINDEV.c and WINDEV.h files from the "External Languages\EN\C" subdirectory of WINDEV to your application's directory. These files replace the existing files.
  3. Delete the calls to CALLDDE from your C application. This function could only be used in the applications in 16-bit mode.
  4. You can manage menus through one of the following methods:
    • Retrieving the shortcuts of menus with WDKEY = "*M*":
      BOOL bEnd = FALSE;
      while (!bEnd)
      {
      CALLWD("Screen,Input");
      if (strcmp(WDKey,"*M*") == 0)
      {
      if (strcmp(WDString,"FO") == 0) OpenFile;
      if (strcmp(WDString,"FS") == 0) SaveFile;
      if (strcmp(WDString,"FQ") == 0) bEnd = TRUE;
      }
    • Retrieving the shortcuts of menus by managing the shortcut in the option directly:
      1. In the code of each menu option to process, assign the shortcut to the WDKey keyword. For example, for File..Open:
        WDKey="FO";
      2. Modify the C code as follows:
        BOOL bEnd = FALSE;
        while (!bEnd)
        {
        CALLWD("Screen,Input");
        if (strcmp(WDKey,"FO") == 0) OpenFile;
        if (strcmp(WDKey,"FS") == 0) SaveFile;
        if (strcmp(WDKey,"FQ") == 0) bEnd = TRUE;
        if (strcmp(WDKey,"ESC") == 0) bEnd = TRUE;
        }
  5. Re-create the library of your WINDEV application.
  6. Recompile your C project.
  7. Copy the necessary WINDEV DLLs into the directory of the executable of your application. Caution: wdxxxle.dll is mandatory.
Remark: To find out the list of necessary DLLs, create the executable of your application in WINDEV.
Managing data files in C or C++
To migrate a WINDEV 5.5 application that manages the data files in C or C++:
  1. Migrate your project from WINDEV 5.5 to WINDEV 7.5 and open it with WINDEV 2024.
  2. Generate the skeleton of your application in version 2024:
    • open the data model editor (Load project analysis in the quick access buttons).
    • on the "Analysis" tab, in the "Analysis" group, expand "Generation" and select "Advanced generation".
      Caution: Don't overwrite the skeleton used by your application.
  3. Create the library of your WINDEV application. Create (if necessary) a project configuration of "Library" type and generate this configuration.
  4. Delete the WDHF5.c and WDHF5.h files from the directory of your source codes to avoid any confusion.
  5. In your C project, delete the reference of dependency to the WDHF5.c and WDHF5.H files.
  6. Copy the following files from the "External Languages\EN\C" subdirectory of WINDEV to your application's directory.
    • HFConstant.h
    • HFContext.cpp
    • HFContext.h
    • IHFContext.h
    • WDHF.h
    • WDHF.cpp
    • WINDEV.c
    • WINDEV.h
    • ProXY.h
    • Central.h
    • the <Analysis name> file. h generated by the WINDEV analysis (point 2). This file is located in the directory of the analysis of the WINDEV project.
    • the <Analysis name>.cpp file generated by the WINDEV analysis (point 2). This file is located in the directory of the analysis of the WINDEV project.
    • the library (.WDL file) of the WINDEV application.
  7. Add the following files to the C project:
    • HFContext.cpp
    • WDHF.cpp
  8. In the initial C source:
    • Replace #include "wdhf5.h" by #include"wdhf.h".
    • Replace #include "*.WDR" by #include"<Analysis>.h" where <Analysis> corresponds to the name of your analysis.
    • Copy the declarations of structure found in the <Analysis>.cpp skeleton and rename them. These declarations must be copied right after #include"<Analysis>.h".
      The declarations of structure have the following format:
      st<FILE> g<FILE>

      where FILE is the name of the file (in uppercase characters).
      These declarations must be renamed as follows:
      st<FILE> <File Abbreviation>

      where File Abbreviation corresponds to the abbreviation used to designate the file.
    • If your code uses HOpenAnalysis, you must specify the extension of the analysis file (.WDD) in the first parameter of the function.
    • Delete the following lines from the C source code:
      • the declaration of the array corresponding to the HFSQL context.
        /* Array used to initialize the HFSQL context*/
        stHFFileCtx stArrCtx[]=\{
        { (char*)&dp,sizeof(st),"STATE",NULL },
        { (char*)&dp,sizeof(ci),"CITY",NULL },
        .....
        };
        # define NBCTX (sizeof(stArrCtx)/sizeof(stHFFileCtx))
      • the HFSQL initialization
        /* mandatory initialization of HFSQL */
        CALLWD("HFCTX");
        if (!Hinitshare(WDLong,&stArrCtx[0],NBCTX))
        {CALLWD("Error, Error initializing the HF context.");}

        This code must be replaced with the following line:
        bInitHF()
      • the call to hfEndShare.
    • Copy the following lines of code found in the <Analysis>.cpp skeleton and rename them. These lines must be copied right after bInitHF.
      Code found in the skeleton (one line per file):
      gclHF.bAssociate(<FILE>,&g<FILE>,sizeof(g<FILE>));

      where FILE is the name of the file (in uppercase characters).
      These declarations must be modified as follows:
      bAssociate(<FICHIER>,&<File Abbreviation>,sizeof(<File Abbreviation>));

      where File Abbreviation corresponds to the abbreviation used to designate the file.
  9. Recompile your C or C++ project+.
  10. Copy the necessary WINDEV DLLs into the directory of the executable of your application.
    Caution: wdxxxle.dll is mandatory.
Remark: To find out the list of necessary DLLs, create the executable of your application in WINDEV.
Minimum version required
  • Version 9
Comments
Click [Add] to post a comment

Last update: 09/08/2023

Send a report | Local help