小编Rob*_*n B的帖子

ECL - 为每个编译单元及其依赖项转储c源?

我有以下包定义.如何递归编译所有组件,以及它们与C源的依赖关系?换句话说,我想保留构建本机可执行文件的所有 C文件.

目前,我使用(asdf:make-build :example但不会留下任何C文件.

我期待着看到

simple.c
simple.h
simple.data
cl-opengl.c
cl-opengl.h
...
Run Code Online (Sandbox Code Playgroud)

example.asd:

(defsystem :example
  :depends-on (:cl-opengl :cl-glu :cl-glut)
  :serial t
  :components ((:file "simple")))
Run Code Online (Sandbox Code Playgroud)

CL-opengl.asd:

(defsystem cl-opengl
  :description "Common Lisp bindings to OpenGL."
  :depends-on (cffi alexandria)
  :components
  ((:module "gl"
    :components
    ((:file "bindings-package")
     (:file "constants" :depends-on ("bindings-package"))
     (:file "library" :depends-on ("bindings-package"))
     (:file "bindings" :depends-on ("bindings-package" "constants" "library"))
     ...
Run Code Online (Sandbox Code Playgroud)

lisp compilation asdf ecl

6
推荐指数
1
解决办法
698
查看次数

CL和SWIG:工作实例?

做一个SWIG教程,并使用example.c,example.i,因为他们在那里提供.我生成了lisp文件swig -cffi example.i.

但是,当我test.lisp与SBCL一起运行时,我会收到关于未定义外来函数的投诉,以及编译example.lisp自身时的投诉.我很确定我仍然需要将我的example.c编译成一个库然后以某种方式告诉SBCL加载它!但该文档是在这个非常稀少,除了这个.

有人可以告诉我如何做到这一点,还是有一种比SWIG更好的方法从C/C++源自动生成CFFI绑定?

sbcl输出:

...
; 
; caught STYLE-WARNING:
;   Undefined alien: "fact"
; 
; compilation unit finished
;   caught 1 STYLE-WARNING condition
; 
; caught STYLE-WARNING:
;   Undefined alien: "my_mod"
...
Run Code Online (Sandbox Code Playgroud)

test.lisp

;call C functions defined in example.c

(require :cffi)
;;;(require :example "example.lisp")
(load "example.lisp")
(fact 2)
(quit)
Run Code Online (Sandbox Code Playgroud)

swig sbcl common-lisp

6
推荐指数
1
解决办法
1088
查看次数

标签 统计

asdf ×1

common-lisp ×1

compilation ×1

ecl ×1

lisp ×1

sbcl ×1

swig ×1