From 892a3e92f3458fec70f47ec74f8660affa6d8fdd Mon Sep 17 00:00:00 2001 From: Kris Katterjohn Date: Tue, 14 Mar 2017 15:51:13 -0500 Subject: [PATCH 1/4] Remove some unused variables --- src/c/ffi/libraries.d | 1 - src/c/load.d | 2 +- src/c/printer/float_to_digits.d | 1 - src/c/serialize.d | 2 +- src/c/tcp.d | 4 +--- src/c/threads/barrier.d | 1 - src/c/threads/semaphore.d | 1 - src/c/unixfsys.d | 2 +- 8 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/c/ffi/libraries.d b/src/c/ffi/libraries.d index 51d22695d..c55a327e6 100644 --- a/src/c/ffi/libraries.d +++ b/src/c/ffi/libraries.d @@ -284,7 +284,6 @@ cl_object ecl_library_open(cl_object filename, bool force_reload) { cl_object block; bool self_destruct = 0; - char *filename_string; /* Coerces to a file name but does not merge with cwd */ filename = coerce_to_physical_pathname(filename); diff --git a/src/c/load.d b/src/c/load.d index 211a660d4..3daf9a130 100644 --- a/src/c/load.d +++ b/src/c/load.d @@ -21,7 +21,7 @@ si_load_binary(cl_object filename, cl_object verbose, cl_object print, cl_object external_format) { const cl_env_ptr the_env = ecl_process_env(); - cl_object block, map, array; + cl_object block; cl_object basename; cl_object init_prefix, prefix; cl_object output; diff --git a/src/c/printer/float_to_digits.d b/src/c/printer/float_to_digits.d index 6b795f522..942c3750b 100644 --- a/src/c/printer/float_to_digits.d +++ b/src/c/printer/float_to_digits.d @@ -176,7 +176,6 @@ change_precision(float_approx *approx, cl_object position, cl_object relativep) { cl_object e1 = cl_expt(PRINT_BASE, position); cl_object e2 = ecl_divide(e1, ecl_make_fixnum(2)); - cl_object e3 = cl_expt(PRINT_BASE, k); if (ecl_greatereq(ecl_plus(approx->r, ecl_times(approx->s, e1)), ecl_times(approx->s, e2))) position = ecl_one_minus(position); diff --git a/src/c/serialize.d b/src/c/serialize.d index 29915b51d..56a7c3a9f 100644 --- a/src/c/serialize.d +++ b/src/c/serialize.d @@ -114,7 +114,7 @@ fix_to_ptr(cl_object ptr) static cl_object enqueue(pool_t pool, cl_object what) { - cl_object record, index; + cl_object index; if (ECL_FIXNUMP(what) || ECL_CHARACTERP(what) || what == OBJNULL) { return what; } diff --git a/src/c/tcp.d b/src/c/tcp.d index 03252311b..07a510ae7 100644 --- a/src/c/tcp.d +++ b/src/c/tcp.d @@ -166,7 +166,6 @@ int create_server_port(int port) { struct sockaddr_in inaddr; /* INET socket address. */ - struct sockaddr *addr; /* address to connect to */ int addrlen; /* length of address */ int request, conn; /* Network socket */ @@ -269,7 +268,7 @@ create_server_port(int port) cl_object si_open_client_stream(cl_object host, cl_object port) { - int fd, p; /* file descriptor */ + int fd; /* file descriptor */ cl_object stream; /* Ensure "host" is a string that we can pass to a C function */ @@ -281,7 +280,6 @@ si_open_client_stream(cl_object host, cl_object port) FEwrong_type_nth_arg(@[si::open-client-stream], 2, port, ecl_read_from_cstring("(INTEGER 0 65535)")); } - p = ecl_fixnum(port); if (host->base_string.fillp > BUFSIZ - 1) FEerror("~S is a too long file name.", 1, host); diff --git a/src/c/threads/barrier.d b/src/c/threads/barrier.d index 9162f5505..d0eac960b 100755 --- a/src/c/threads/barrier.d +++ b/src/c/threads/barrier.d @@ -137,7 +137,6 @@ mp_barrier_wait(cl_object barrier) cl_object output; cl_fixnum counter; cl_env_ptr the_env = ecl_process_env(); - cl_object own_process = the_env->own_process; unlikely_if (ecl_t_of(barrier) != t_barrier) { FEerror_not_a_barrier(barrier); diff --git a/src/c/threads/semaphore.d b/src/c/threads/semaphore.d index a428f1167..04078f61c 100644 --- a/src/c/threads/semaphore.d +++ b/src/c/threads/semaphore.d @@ -125,7 +125,6 @@ cl_object mp_try_get_semaphore(cl_object semaphore) { cl_env_ptr env = ecl_process_env(); - cl_object output; unlikely_if (ecl_t_of(semaphore) != t_semaphore) { FEerror_not_a_semaphore(semaphore); } diff --git a/src/c/unixfsys.d b/src/c/unixfsys.d index dd20a156f..29cacbf6c 100644 --- a/src/c/unixfsys.d +++ b/src/c/unixfsys.d @@ -579,7 +579,7 @@ cl_delete_file(cl_object file) cl_object path = cl_pathname(file); int isdir = directory_pathname_p(path); cl_object filename = si_coerce_to_filename(path); - int ok, code; + int ok; ecl_disable_interrupts(); ok = (isdir? rmdir : unlink)((char*)filename->base_string.self); From 5095097a6a83e6f6af137e9c8844d92de4b2392d Mon Sep 17 00:00:00 2001 From: Kris Katterjohn Date: Tue, 14 Mar 2017 15:53:32 -0500 Subject: [PATCH 2/4] Wrap variable definitions in #ifdef's to avoid unused-variable warnings --- src/c/alloc_2.d | 2 ++ src/c/unixfsys.d | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/c/alloc_2.d b/src/c/alloc_2.d index d2841f5ca..f6672e11a 100644 --- a/src/c/alloc_2.d +++ b/src/c/alloc_2.d @@ -760,8 +760,10 @@ to_bitmap(void *x, void *y) void init_alloc(void) { +#ifdef GBC_BOEHM_PRECISE union cl_lispunion o; struct ecl_cons c; +#endif int i; if (alloc_initialized) return; alloc_initialized = TRUE; diff --git a/src/c/unixfsys.d b/src/c/unixfsys.d index 29cacbf6c..1f09835fe 100644 --- a/src/c/unixfsys.d +++ b/src/c/unixfsys.d @@ -454,7 +454,9 @@ ecl_file_len(int f) @(defun rename-file (oldn newn &key (if_exists @':error')) cl_object old_filename, new_filename, old_truename, new_truename; +#if defined(ECL_MS_WINDOWS_HOST) int error; +#endif @ /* 1) Get the old filename, and complain if it has wild components, @@ -658,7 +660,10 @@ ecl_homedir_pathname(cl_object user) { cl_index i; cl_object namestring; - const char *h, *d; + const char *h; +#if defined(ECL_MS_WINDOWS_HOST) + const char *d; +#endif if (!Null(user)) { #ifdef HAVE_PWD_H struct passwd *pwent = NULL; From 3b1db15c2b15cec1598b50a6cdf34f8295d0fb8d Mon Sep 17 00:00:00 2001 From: Kris Katterjohn Date: Tue, 14 Mar 2017 15:57:03 -0500 Subject: [PATCH 3/4] Use some previously unused variables --- src/c/hash.d | 2 +- src/c/tcp.d | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/c/hash.d b/src/c/hash.d index 5f44eebfb..279ac5bab 100644 --- a/src/c/hash.d +++ b/src/c/hash.d @@ -218,7 +218,7 @@ _hash_equalp(int depth, cl_hashkey h, cl_object x) struct ecl_hashtable_entry *e = hashtable->hash.data + i; \ cl_object hkey = e->key, hvalue = e->value; \ if (hkey == OBJNULL) { \ - if (e->value == OBJNULL) { \ + if (hvalue == OBJNULL) { \ if (j == hsize) \ return e; \ else \ diff --git a/src/c/tcp.d b/src/c/tcp.d index 07a510ae7..b1849a169 100644 --- a/src/c/tcp.d +++ b/src/c/tcp.d @@ -206,7 +206,8 @@ create_server_port(int port) #endif /* Set up the socket data. */ - memset((char *)&inaddr, 0, sizeof(inaddr)); + addrlen = sizeof (struct sockaddr_in); + memset((char *)&inaddr, 0, addrlen); inaddr.sin_family = AF_INET; #if defined(ECL_MS_WINDOWS_HOST) inaddr.sin_port = htons((unsigned short)port); @@ -215,7 +216,7 @@ create_server_port(int port) #endif inaddr.sin_addr.s_addr = htonl(INADDR_ANY); - if (bind(request, (struct sockaddr *)&inaddr, sizeof (inaddr))) + if (bind(request, (struct sockaddr *)&inaddr, addrlen)) FElibc_error("Binding TCP socket", 0); if (listen(request, 1)) FElibc_error("TCP listening", 0); From fb7117a171fa981ef331b33928b916fec4df06a6 Mon Sep 17 00:00:00 2001 From: Bo Yao Date: Wed, 15 Mar 2017 13:08:34 -0400 Subject: [PATCH 4/4] add an example for build asdf with dependence --- .../asdf_with_dependence/example-with-dep.asd | 5 + examples/asdf_with_dependence/example.lisp | 4 + examples/asdf_with_dependence/package.lisp | 5 + examples/asdf_with_dependence/readme.org | 160 +++++++++++++ examples/asdf_with_dependence/readme.txt | 219 ++++++++++++++++++ examples/asdf_with_dependence/test-static.c | 14 ++ examples/asdf_with_dependence/test.c | 14 ++ 7 files changed, 421 insertions(+) create mode 100644 examples/asdf_with_dependence/example-with-dep.asd create mode 100644 examples/asdf_with_dependence/example.lisp create mode 100644 examples/asdf_with_dependence/package.lisp create mode 100644 examples/asdf_with_dependence/readme.org create mode 100644 examples/asdf_with_dependence/readme.txt create mode 100644 examples/asdf_with_dependence/test-static.c create mode 100644 examples/asdf_with_dependence/test.c diff --git a/examples/asdf_with_dependence/example-with-dep.asd b/examples/asdf_with_dependence/example-with-dep.asd new file mode 100644 index 000000000..cd385e6f0 --- /dev/null +++ b/examples/asdf_with_dependence/example-with-dep.asd @@ -0,0 +1,5 @@ +(defsystem :example-with-dep + :serial t + :depends-on (:alexandria) + :components ((:file "package") + (:file "example"))) diff --git a/examples/asdf_with_dependence/example.lisp b/examples/asdf_with_dependence/example.lisp new file mode 100644 index 000000000..ee3eb2bc2 --- /dev/null +++ b/examples/asdf_with_dependence/example.lisp @@ -0,0 +1,4 @@ +(in-package :example) + +(defun test-function (n) + (format t "Factorial of ~a is: ~a~%" n (alexandria:factorial n))) diff --git a/examples/asdf_with_dependence/package.lisp b/examples/asdf_with_dependence/package.lisp new file mode 100644 index 000000000..231935c57 --- /dev/null +++ b/examples/asdf_with_dependence/package.lisp @@ -0,0 +1,5 @@ +(in-package :cl-user) + +(defpackage :example + (:use :cl) + (:export :test-function)) diff --git a/examples/asdf_with_dependence/readme.org b/examples/asdf_with_dependence/readme.org new file mode 100644 index 000000000..c454745de --- /dev/null +++ b/examples/asdf_with_dependence/readme.org @@ -0,0 +1,160 @@ +#+TITLE: Build an asdf system with dependences +#+AUTHOR: Bo Yao + +Besides the simple situation that we write Lisp without depending on any other Lisp libraries, a more practical example is build a library depends on other asdf systems or Quicklisp projects. Thanks to the ECL's great extension on ~asdf:make-build~, it's almost as easy as build a library without dependences. Because Quicklisp also uses asdf to load systems with dependences, just make sure you have successfully load and run your library in ECL REPL (or ~*slime-repl*~). Don't worry Quicklisp, asdf, swank and other unused libraries are packed into the executable or library, ECL will only build and pack libraries your project depends on (that is, all dependences you put in your ~.asd~ file, and their dependences, nothing more even you are build in a image already load with lots of other libraries). + +** Example code to build +We use a simple project depends on alexandria to demostrate the steps. Consists of ~example-with-dep.asd~, ~package.lisp~ and ~example.lisp~. For convinience, we list these files here: + +#+BEGIN_SRC common-lisp +;;;; example-with-dep.asd +(defsystem :example-with-dep + :serial t + :depends-on (:alexandria) + :components ((:file "package") + (:file "example"))) + +#+END_SRC + +#+BEGIN_SRC common-lisp +;;;; package.lisp +(in-package :cl-user) + +(defpackage :example + (:use :cl) + (:export :test-function)) +#+END_SRC + +#+BEGIN_SRC common-lisp +;;;; example.lisp +(in-package :example) + +(defun test-function (n) + (format t "Factorial of ~a is: ~a~%" n (alexandria:factorial n))) +#+END_SRC + +Before any kind you build, you need to push full path of this directory (~asdf_with_dependence/~) into ~asdf:*central-registry*~. + +** Build it as an single executable + +Use this in REPL to make a executable: + +#+BEGIN_SRC common-lisp +(asdf:make-build :example-with-dep + :type :program + :move-here #P"./" + :epilogue-code '(progn (example:test-function 5) + (si:exit))) +#+END_SRC +Here the ~:epilogue-code~ is what to do after loading our library, we can use arbitrary Lisp forms here. You can also write this code in your Lisp files and directly build them without this ~:epilogue-code~ option to have the same effect. +Run the program in console will display the following and exit: + +#+BEGIN_SRC shell +Factorial of 5 is: 120 +#+END_SRC + +** Build it as shared library and use in C +Use this in REPL to make a shared library: +#+BEGIN_SRC common-lisp +(asdf:make-build :example-with-dep + :type :shared-library + :move-here #P"./" + :monolithic t) +#+END_SRC + +Here ~:monolithic t~ means to let ECL solve dependence and build all denpendence into one library named ~example-with-dep--all-systems.so~ in this directory. + +To use it, we use a simple C program: + +#+BEGIN_SRC c +/* test.c */ +#include + +int main (int argc, char **argv) { + extern void init_dll_EXAMPLE_WITH_DEP__ALL_SYSTEMS(cl_object); + + cl_boot(argc, argv); + ecl_init_module(NULL, init_dll_EXAMPLE_WITH_DEP__ALL_SYSTEMS); + + /* do things with the Lisp library */ + cl_eval(c_string_to_object("(example:test-function 5)")); + + cl_shutdown(); + return 0; +} + +#+END_SRC + +Note the name convention here: an asdf system named ~example-with-dep~ will compiled to ~example-with-dep--all-systems.so~ and in the C code should be init with ~init_dll_EXAMPLE_WITH_DEP__ALL_SYSTEMS~. Compile it using: + +#+BEGIN_SRC shell +gcc test.c example-with-dep--all-systems.so -o test -lecl +#+END_SRC + +ECL's library path and current directory may not be in your ~LD_LIBRARY_PATH~, so call ~./test~ using: + +#+BEGIN_SRC shell +LD_LIBRARY_PATH=/usr/local/lib/:. ./test +#+END_SRC + +This will show: + +#+BEGIN_SRC shell +Factorial of 5 is: 120 +#+END_SRC + +You can also build all dependent libraries separately as several ~.so~ files and link them together. For example, if you are building a library called ~complex-example~, that depends on ~alexandria~ and ~cl-fad~, you can also do these in ECL REPL: + +#+BEGIN_SRC common-lisp +(asdf:make-build :complex-example + :type :shared-library + :move-here #P"./") +(asdf:make-build :alexandria + :type :shared-library + :move-here #P"./") +(asdf:make-build :cl-fad + :type :shared-library + :move-here #P"./") +(asdf:make-build :bordeaux-threads + :type :shared-library + :move-here #P"./") +#+END_SRC + +Note here is no ~:monolithic t~ and we also need to build ~bordeaux-threads~ because ~cl-fad~ depends on it. The building sequence doesn't matter and the result ~.so~ files can also be used in your future program if these libraries are not modified. +And We need to init all these modules using ~ecl_init_module~, the name convention is to init ~cl-fad~ you need: + +#+BEGIN_SRC c +extern void init_dll_CL_FAD(cl_object); + +/* after cl_boot(argc, argv); + and if B depends on A, you should first init A then B. */ +ecl_init_module(NULL, init_dll_CL_FAD); + +#+END_SRC + +You can easily figure out name conventions with other libraries. + +** Build it as static library and use in C +To build a static library, use: + +#+BEGIN_SRC common-lisp +(asdf:make-build :example-with-dep + :type :static-library + :move-here #P"./" + :monolithic t) +#+END_SRC + +That will generate a ~example-with-dep--all-systems.a~ in current directory and we need to replace ~init_dll_EXAMPLE_WITH_DEP__ALL_SYSTEMS~ with ~init_lib_EXAMPLE_WITH_DEP__ALL_SYSTEMS~. (The code is given in test-static.c) And compile it using: + +#+BEGIN_SRC shell +gcc test-static.c example-with-dep--all-systems.a -o test-static -lecl +#+END_SRC + +Then run it: + +#+BEGIN_SRC shell +LD_LIBRARY_PATH=/usr/local/lib/ ./test-static +#+END_SRC + +Note we don't need to give current path in ~LD_LIBRARY_PATH~ here, since our Lisp library is statically bundled to the executable. +The result is same as the shared library example above. You can also build all dependent libraries separately to static libraries. To use them you also need replace names like ~init_dll_CL_FAD~ to ~init_lib_CL_FAD~. diff --git a/examples/asdf_with_dependence/readme.txt b/examples/asdf_with_dependence/readme.txt new file mode 100644 index 000000000..5acf1b35a --- /dev/null +++ b/examples/asdf_with_dependence/readme.txt @@ -0,0 +1,219 @@ + ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + BUILD AN ASDF SYSTEM WITH DEPENDENCES + + Bo Yao + ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + + +Table of Contents +───────────────── + +1 Example code to build +2 Build it as an single executable +3 Build it as shared library and use in C +4 Build it as static library and use in C + + +Besides the simple situation that we write Lisp without depending on any +other Lisp libraries, a more practical example is build a library +depends on other asdf systems or Quicklisp projects. Thanks to the ECL's +great extension on `asdf:make-build', it's almost as easy as build a +library without dependences. Because Quicklisp also uses asdf to load +systems with dependences, just make sure you have successfully load and +run your library in ECL REPL (or `*slime-repl*'). Don't worry Quicklisp, +asdf, swank and other unused libraries are packed into the executable or +library, ECL will only build and pack libraries your project depends on +(that is, all dependences you put in your `.asd' file, and their +dependences, nothing more even you are build in a image already load +with lots of other libraries). + + +1 Example code to build +═══════════════════════ + + We use a simple project depends on alexandria to demostrate the + steps. Consists of `example-with-dep.asd', `package.lisp' and + `example.lisp'. For convinience, we list these files here: + + ┌──── + │ ;;;; example-with-dep.asd + │ (defsystem :example-with-dep + │ :serial t + │ :depends-on (:alexandria) + │ :components ((:file "package") + │ (:file "example"))) + └──── + + ┌──── + │ ;;;; package.lisp + │ (in-package :cl-user) + │ + │ (defpackage :example + │ (:use :cl) + │ (:export :test-function)) + └──── + + ┌──── + │ ;;;; example.lisp + │ (in-package :example) + │ + │ (defun test-function (n) + │ (format t "Factorial of ~a is: ~a~%" n (alexandria:factorial n))) + └──── + + Before any kind you build, you need to push full path of this + directory (`asdf_with_dependence/') into `asdf:*central-registry*'. + + +2 Build it as an single executable +══════════════════════════════════ + + Use this in REPL to make a executable: + + ┌──── + │ (asdf:make-build :example-with-dep + │ :type :program + │ :move-here #P"./" + │ :epilogue-code '(progn (example:test-function 5) + │ (si:exit))) + └──── + Here the `:epilogue-code' is what to do after loading our library, we + can use arbitrary Lisp forms here. You can also write this code in + your Lisp files and directly build them without this `:epilogue-code' + option to have the same effect. Run the program in console will + display the following and exit: + + ┌──── + │ Factorial of 5 is: 120 + └──── + + +3 Build it as shared library and use in C +═════════════════════════════════════════ + + Use this in REPL to make a shared library: + ┌──── + │ (asdf:make-build :example-with-dep + │ :type :shared-library + │ :move-here #P"./" + │ :monolithic t) + └──── + + Here `:monolithic t' means to let ECL solve dependence and build all + denpendence into one library named `example-with-dep--all-systems.so' + in this directory. + + To use it, we use a simple C program: + + ┌──── + │ /* test.c */ + │ #include + │ + │ int main (int argc, char **argv) { + │ extern void init_dll_EXAMPLE_WITH_DEP__ALL_SYSTEMS(cl_object); + │ + │ cl_boot(argc, argv); + │ ecl_init_module(NULL, init_dll_EXAMPLE_WITH_DEP__ALL_SYSTEMS); + │ + │ /* do things with the Lisp library */ + │ cl_eval(c_string_to_object("(example:test-function 5)")); + │ + │ cl_shutdown(); + │ return 0; + │ } + └──── + + Note the name convention here: an asdf system named `example-with-dep' + will compiled to `example-with-dep--all-systems.so' and in the C code + should be init with `init_dll_EXAMPLE_WITH_DEP__ALL_SYSTEMS'. Compile + it using: + + ┌──── + │ gcc test.c example-with-dep--all-systems.so -o test -lecl + └──── + + ECL's library path and current directory may not be in your + `LD_LIBRARY_PATH', so call `./test' using: + + ┌──── + │ LD_LIBRARY_PATH=/usr/local/lib/:. ./test + └──── + + This will show: + + ┌──── + │ Factorial of 5 is: 120 + └──── + + You can also build all dependent libraries separately as several `.so' + files and link them together. For example, if you are building a + library called `complex-example', that depends on `alexandria' and + `cl-fad', you can also do these in ECL REPL: + + ┌──── + │ (asdf:make-build :complex-example + │ :type :shared-library + │ :move-here #P"./") + │ (asdf:make-build :alexandria + │ :type :shared-library + │ :move-here #P"./") + │ (asdf:make-build :cl-fad + │ :type :shared-library + │ :move-here #P"./") + │ (asdf:make-build :bordeaux-threads + │ :type :shared-library + │ :move-here #P"./") + └──── + + Note here is no `:monolithic t' and we also need to build + `bordeaux-threads' because `cl-fad' depends on it. The building + sequence doesn't matter and the result `.so' files can also be used in + your future program if these libraries are not modified. And We need + to init all these modules using `ecl_init_module', the name convention + is to init `cl-fad' you need: + + ┌──── + │ extern void init_dll_CL_FAD(cl_object); + │ + │ /* after cl_boot(argc, argv); + │ and if B depends on A, you should first init A then B. */ + │ ecl_init_module(NULL, init_dll_CL_FAD); + └──── + + You can easily figure out name conventions with other libraries. + + +4 Build it as static library and use in C +═════════════════════════════════════════ + + To build a static library, use: + + ┌──── + │ (asdf:make-build :example-with-dep + │ :type :static-library + │ :move-here #P"./" + │ :monolithic t) + └──── + + That will generate a `example-with-dep--all-systems.a' in current + directory and we need to replace + `init_dll_EXAMPLE_WITH_DEP__ALL_SYSTEMS' with + `init_lib_EXAMPLE_WITH_DEP__ALL_SYSTEMS'. (The code is given in + test-static.c) And compile it using: + + ┌──── + │ gcc test-static.c example-with-dep--all-systems.a -o test-static -lecl + └──── + + Then run it: + + ┌──── + │ LD_LIBRARY_PATH=/usr/local/lib/ ./test-static + └──── + + Note we don't need to give current path in `LD_LIBRARY_PATH' here, + since our Lisp library is statically bundled to the executable. The + result is same as the shared library example above. You can also build + all dependent libraries separately to static libraries. To use them + you also need replace names like `init_dll_CL_FAD' to + `init_lib_CL_FAD'. diff --git a/examples/asdf_with_dependence/test-static.c b/examples/asdf_with_dependence/test-static.c new file mode 100644 index 000000000..7704ed99b --- /dev/null +++ b/examples/asdf_with_dependence/test-static.c @@ -0,0 +1,14 @@ +#include + +int main (int argc, char **argv) { + extern void init_lib_EXAMPLE_WITH_DEP__ALL_SYSTEMS(cl_object); + + cl_boot(argc, argv); + ecl_init_module(NULL, init_lib_EXAMPLE_WITH_DEP__ALL_SYSTEMS); + + /* do things with the Lisp library */ + cl_eval(c_string_to_object("(example:test-function 5)")); + + cl_shutdown(); + return 0; +} diff --git a/examples/asdf_with_dependence/test.c b/examples/asdf_with_dependence/test.c new file mode 100644 index 000000000..e98dff74b --- /dev/null +++ b/examples/asdf_with_dependence/test.c @@ -0,0 +1,14 @@ +#include + +int main (int argc, char **argv) { + extern void init_dll_EXAMPLE_WITH_DEP__ALL_SYSTEMS(cl_object); + + cl_boot(argc, argv); + ecl_init_module(NULL, init_dll_EXAMPLE_WITH_DEP__ALL_SYSTEMS); + + /* do things with the Lisp library */ + cl_eval(c_string_to_object("(example:test-function 5)")); + + cl_shutdown(); + return 0; +}