Re: extern

new topic     » goto parent     » topic index » view thread      » older message » newer message

Bernie Ryan writes:

> Why is there no extern directive in the translator/compiler
> How can Euphoria be linked to any other "C" object...
> ...Now that the translator is available it has no way to define
>  and call a "C" function that is NOT contain in a DLL or SO.
>  Are you prepared to wait for another 4 years to see if it
>  might be added.

The current translator converts your Euphoria code into
C code. You can do *anything* you like with that C code,
including adding extern declarations and calling C functions
in dynamic *or static* libraries.

With the current (alpha-release) translator I would recommend
the following:
       1. make a .e file, bernie.e, that contains dummy (empty)
            Euphoria procedures and functions.
       2. translate your program to C
       3. make your own copy of bernie.c that has extern declarations
           and inserts calls to C functions from the
           dummy Euphoria routines (now dummy C routines)
       4. Run emake.bat to build your .exe. You can add
           additional static or dynamic libraries to the link.

After each translation you will have to overwrite bernie.c
with your modified version. Maybe you can make a .bat
for this, or make your own modified emake.bat that ignores
bernie.c, and uses your modified bernie2.c.

Mechanisms for a smoother interface to C code
will be added to the translator as it matures, and we learn
more about what people want to do with the translator.

Regards,
   Rob Craig
   Rapid Deployment Software
   http://www.RapidEuphoria.com

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu