Next: , Previous: Temporary Files, Up: Microsoft Windows Topics

9.3.5 Mixed-Language Programming on Windows

Developing pure Ada applications on Windows is no different than on other GNAT-supported platforms. However, when developing or porting an application that contains a mix of Ada and C/C++, the choice of your Windows C/C++ development environment conditions your overall interoperability strategy.

If you use `gcc' or Microsoft C to compile the non-Ada part of your application, there are no Windows-specific restrictions that affect the overall interoperability with your Ada code. If you do want to use the Microsoft tools for your C++ code, you have two choices:

In addition to the description about C main in Mixed Language Programming section, if the C main uses a stand-alone library it is required on x86-windows to setup the SEH context. For this the C main must looks like this:

    /* main.c */
    extern void adainit (void);
    extern void adafinal (void);
    extern void __gnat_initialize(void*);
    extern void call_to_ada (void);
    int main (int argc, char *argv[])
      int SEH [2];
      /* Initialize the SEH context */
      __gnat_initialize (&SEH);
      /* Then call Ada services in the stand-alone library */

Note that this is not needed on x86_64-windows where the Windows native SEH support is used.