[Ecls-list] How to prepend a "prologue" to the c-code generated by asdf:make-build?

Dietrich Bollmann dietrich at formgames.org
Thu Jul 11 10:30:57 UTC 2013


[An answer to my own question in the hope to help others experimenting the
same problem]

Hi,

I found the following hack to overcome the problem:

The name of the header file included at the top of the generated c file is
defined in the variable COMPILER::*cmpinclude*.  It is therefore possible
to overwrite the variable and to include a different file.  Using my own
header file which first includes StdAfx.h and after the header defined by
the original value of COMPILER::*cmpinclude* solves the problem...

Here in more detail:

--- RhinoLispPrologue.h ---
#include "StdAfx.h"
#include <ecl/ecl-cmp.h>
---

I then build the library with

  (let ((COMPILER::*cmpinclude* "\"RhinoLispPrologue.h\""))
    (asdf:make-build system ...)

Thanks,

Dietrich



On Sun, Jul 7, 2013 at 9:22 PM, Dietrich Bollmann <dietrich at formgames.org>wrote:

> Hi,
>
> I am trying to use ECL as scripting language for a large Windows program
> (Rhino3D).
>
> When including the precompiled headers required by Rhino plugins with
>
>    (ffi:clines "#include \"StdAfx.h\")
>
> and building the library with (asdf:make-build system :type
> :shared-library ...)
>
> I get the following error:
>
>   fatal error C1189: #error :  WINDOWS.H already included.  MFC apps must
> not #include <windows.h>
>
> Moving the include statement to the very top of the generated c file
> (before the #include <ecl/ecl-cmp.h> sttement), however, and compiling
> manually works.
>
> I tried to make use of the "prologue-code" option and solve the problem by
> prepending the include statement to the generated code as follows:
>
>   (asdf:make-build system :type :shared-library :prologue-code "#include
> \"StdAfx.h\"" ...)
>
> But the prologue-option string was not inserted anywhere into the
> generated code.
>
> Any idea about how to solve the problem?
>
> Thanks for your help,
>
> Dietrich
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/ecl-devel/attachments/20130711/7308bb3a/attachment.html>


More information about the ecl-devel mailing list