On Sun, 15 Jul 2012 22:41:35 +0200 (CEST)
e...@ecky.fr wrote:

> Hello,
> 
> I'm currently evaluating the possibility to use ECL for my software-project 
> and it is important for me that the language I use is interpreted with 
> optional partial compilation on demande (for optimisation reasons). I wonder 
> if ECL has this capacity, because i tested (after having installed ECL) the 
> following code snippet (from the book "Object-Oriented Common Lisp") and I'm 
> getting unexpected results:
> 
> (defun test1 (n)
>   (do ((i 0 (+ i 1)))
>       ((> i n) i)
>       (+ i 1)))
> 
> (functionp #'test1)
> T
> 
> (compiled-function-p #'test1)
> T
> 
> It's the last T that surprises me, should be NIL!? Only if you issue the 
> command (compile 'test1) it should get compiled ...

"Any function may be considered by an implementation to be a a compiled
function if it contains no references to macros that must be expanded
at run time, and it contains no unresolved references to load time
values. See Section 3.2.2 (Compilation Semantics).

Functions whose definitions appear lexically within a file that has
been compiled with compile-file and then loaded with load are of type
compiled-function. Functions produced by the compile function are of
type compiled-function. Other functions might also be of type
compiled-function."

As I understand it, it is allowed for CL implementations to compile
immediately, and ECL immediately compiles to bytecode, which can be
interpreted.  As you know, the second level of compilation ECL supports
is via C translation compiled with a C compiler, which is optional.
But even in the first level bytecode compilation, all macros have
previously been expanded, etc.

I'm note sure, but CLisp seems to also do bytecode compilation
immediately, but keeping functions under the type FUNCTION, with
COMPILE being a noop that makes it of type COMPILED-FUNCTION.  In which
case, it behaves like you expect in relation to COMPILED-FUNCTION-P.

> Next question would be, how can I dynamically load à shared library (or any 
> other) manually by the program in order to access the functions it contains 
> (the program will know itself which library to load and when ...).

If ECL was built with dffi support (and linked against libffi),
*FEATURES* should contain :DFFI, and it should support dynamically
loading libraries at runtime.  Please look at:

FFI:FIND-FOREIGN-LIBRARY  Function
FFI:LOAD-FOREIGN-LIBRARY  Macro

(http://ecls.sourceforge.net/new-manual/rn06.html)
-- 
Matt

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ecls-list mailing list
Ecls-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ecls-list

Reply via email to