Re: [Ecls-list] Embedding C++ code in LISP under Windows

2013-06-16 Thread Dietrich Bollmann
Hi Juanjo,

Thank you!

It was too late in the night when I wrote this email to think clearly:  I
tried to apply my experiences from embedding C++ code via the ECL FFI on my
Mac to Windows... Not a good strategy :)

In both cases I got the same error messages being caused by the compiler
misinterpreting the C++ code as C code.

In the case of my Mac recompiling ECL with '--with-cxx' was the solution.

On Windows, however, the problem is caused by 'asdf:make-build' generating
a file with the extension .c which makes the compiler interpreting the code
as C code.  The command line option /TP can be use to force the compiler to
interpret the content of the file as C++ code.  (See the page "/Tc, /Tp,
/TC, /TP (Specify Source File Type)" at
http://msdn.microsoft.com/en-us/library/032xwy55.aspx .)

Doing so a second error is thrown:  error C4716: 'main_lib_CUBE' : must
return a value ('cube' is the name I called the library). The
option /wo4716 can be used to turn it into a warning resulting in the
library being built. (See "/w, /Wn, /WX, /Wall, /wln, /wdn, /wen, /won
(Warning Level)" at http://msdn.microsoft.com/en-us/library/thxezb7y.aspx )

Here my current solution which builds the library:

In my Makefile:

--- Makefile---
...
cube.lib: cube.asd cube.lisp Cube.obj
ecl -norc -load cube-build.lisp
...
---

The file with the LISP code used to build the library:

---  cube-build.lisp ---
(ext:install-c-compiler)
(require :asdf)
(push "./" asdf:*central-registry*)
(let ((COMPILER::*cc-flags* (concatenate 'string COMPILER::*cc-flags* " /TP
/wo4716 "))
  (COMPILER::*ld-bundle-flags* (concatenate 'string
COMPILER::*ld-bundle-flags* " Cube.obj ")))
  (asdf:make-build :cube :type :static-library :move-here "./cube.lib"))
(quit)
---

On the long term a better solution might be

  - to add some option to 'asdf:make-build' which takes either ':c' or
'cpp' as value (with ':c' being the derault) and generates a file with the
respective extension;
  - to change the LISP to C / C++ compiler so that the generated function
'main_lib_NAMEOFLIBRARY' actually returns a value.

Thanks for you help,

Dietrich



On Mon, Jun 17, 2013 at 12:36 AM, Juan Jose Garcia-Ripoll <
juanjose.garciarip...@gmail.com> wrote:

>
> On Sat, Jun 15, 2013 at 11:47 AM, Dietrich Bollmann <
> dietr...@formgames.org> wrote:
>
>>
>> How can I build ECL on Windows in a way which allows to embed C++ code as
>> well?
>>
>>
> The Windows compiler is a C++ compiler, AFAIK. You should not need to do
> anything extra.
>
>
> --
> Instituto de Física Fundamental, CSIC
> c/ Serrano, 113b, Madrid 28006 (Spain)
> http://juanjose.garciaripoll.googlepages.com
>
--
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev___
Ecls-list mailing list
Ecls-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ecls-list


Re: [Ecls-list] Embedding C++ code in LISP under Windows

2013-06-16 Thread Juan Jose Garcia-Ripoll
On Sat, Jun 15, 2013 at 11:47 AM, Dietrich Bollmann
wrote:

>
> How can I build ECL on Windows in a way which allows to embed C++ code as
> well?
>
>
The Windows compiler is a C++ compiler, AFAIK. You should not need to do
anything extra.


-- 
Instituto de Física Fundamental, CSIC
c/ Serrano, 113b, Madrid 28006 (Spain)
http://juanjose.garciaripoll.googlepages.com
--
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev___
Ecls-list mailing list
Ecls-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ecls-list


Re: [Ecls-list] ECL doesn't support weak key hash-tables?

2013-06-16 Thread Matthew Mondor
On Sun, 16 Jun 2013 14:48:26 +0300
timo.my...@wickedbsd.net (Timo Myyrä) wrote:

> Probably my misconfiguration or quicklisp issue. 
> Seems that the quicklisp loaded older version of trivial-garbage which didn't
> include ECL support. Removed all local trivial-garbage dists and reloaded it 
> and
> everything seems to work.

I'm glad it now works fine,
-- 
Matt

--
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
___
Ecls-list mailing list
Ecls-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ecls-list


Re: [Ecls-list] ECL doesn't support weak key hash-tables?

2013-06-16 Thread Timo Myyrä
Matthew Mondor  writes:

> On Sun, 16 Jun 2013 12:24:23 +0300
> timo.my...@wickedbsd.net (Timo Myyrä) wrote:
>
>> Hi,
>> 
>> When trying to load cl+ssl via quicklisp it raises error that ECL doesn't
>> support weak key hash tables. Problem seems to be raised in trivial-garbage.
>> 
>> Here's quick way to replicate this:
>> 
>> (ql:quickload 'trivial-garbage)
>> CL-USER> (ql:quickload 'trivial-garbage)
>> To load "trivial-garbage":
>>   Load 1 ASDF system:
>> trivial-garbage
>> ; Loading "trivial-garbage"
>
> It's possible that trivial-garbage does not fully support ECL, but ECL
> does support weak hash-table keys and values, passing to
> MAKE-HASH-TABLE one of:
>
> :weakness :key
> :weakness :value
> :weakness :key-and-value
>
> Unfortunately this seems to not yet be in the manual though.

Probably my misconfiguration or quicklisp issue. 
Seems that the quicklisp loaded older version of trivial-garbage which didn't
include ECL support. Removed all local trivial-garbage dists and reloaded it and
everything seems to work.


Timo
 

--
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
___
Ecls-list mailing list
Ecls-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ecls-list


Re: [Ecls-list] ECL doesn't support weak key hash-tables?

2013-06-16 Thread Matthew Mondor
On Sun, 16 Jun 2013 12:24:23 +0300
timo.my...@wickedbsd.net (Timo Myyrä) wrote:

> Hi,
> 
> When trying to load cl+ssl via quicklisp it raises error that ECL doesn't
> support weak key hash tables. Problem seems to be raised in trivial-garbage.
> 
> Here's quick way to replicate this:
> 
> (ql:quickload 'trivial-garbage)
> CL-USER> (ql:quickload 'trivial-garbage)
> To load "trivial-garbage":
>   Load 1 ASDF system:
> trivial-garbage
> ; Loading "trivial-garbage"

It's possible that trivial-garbage does not fully support ECL, but ECL
does support weak hash-table keys and values, passing to
MAKE-HASH-TABLE one of:

:weakness :key
:weakness :value
:weakness :key-and-value

Unfortunately this seems to not yet be in the manual though.
-- 
Matt

--
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
___
Ecls-list mailing list
Ecls-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ecls-list


[Ecls-list] ECL doesn't support weak key hash-tables?

2013-06-16 Thread Timo Myyrä
Hi,

When trying to load cl+ssl via quicklisp it raises error that ECL doesn't
support weak key hash tables. Problem seems to be raised in trivial-garbage.

Here's quick way to replicate this:

(ql:quickload 'trivial-garbage)
CL-USER> (ql:quickload 'trivial-garbage)
To load "trivial-garbage":
  Load 1 ASDF system:
trivial-garbage
; Loading "trivial-garbage"

(TRIVIAL-GARBAGE)
CL-USER> (defvar *threads* (trivial-garbage:make-weak-hash-table :weakness 
:key))
; Evaluation aborted on #.
CL-USER> *features*
(:FLEXI-STREAMS CFFI-FEATURES:FLAT-NAMESPACE CFFI-FEATURES:X86-64
 CFFI-FEATURES:UNIX :CFFI CFFI-SYS::FLAT-NAMESPACE :X86-64 :SWANK :SERVE-EVENT
 :PROFILE :QUICKLISP :ASDF3 :ASDF2 :ASDF :OS-UNIX :NON-BASE-CHARS-EXIST-P
 :ASDF-UNICODE :OPENBSD :FORMATTER :ECL-WEAK-HASH :LITTLE-ENDIAN :LONG-LONG
 :UINT64-T :UINT32-T :UINT16-T :RELATIVE-PACKAGE-NAMES :LONG-FLOAT :UNICODE
 :DFFI :CLOS-STREAMS :CMU-FORMAT :UNIX :ECL-PDE :DLOPEN :CLOS :BOEHM-GC
 :ANSI-CL :COMMON-LISP :IEEE-FLOATING-POINT :PREFIXED-API :FFI :X86_64 :COMMON
 :ECL)
CL-USER>


Is this missing feature or some bug in crept in the system?

Timo

--
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
___
Ecls-list mailing list
Ecls-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ecls-list