Hi,

I've written a library for reading/manipulating/writing elf files [1]
which I would like to be able to call from C code.  I have successfully
compiled the ASDF package defining the library into a libelf.a library
using the following command.

  (asdf:make-build :elf :type :lib :move-here "/home/eschulte/src/elf/")

While this seems to have been successful, and while I have been able to
manipulate generic ECL lisp objects from within C code, I can not figure
out how to access the lisp functions defined in this static library from
a file of C code.

My latest attempt is the following run.c file.
#include <ecl/ecl.h>

// first build a library with
//   (asdf:make-build :elf :type :lib :move-here "/home/eschulte/src/elf/")
int main(int argc, char** argv){
  cl_boot(argc, argv);
  cl_object elf = (make_simple_base_string((char*)"ELF"));
  cl_make_package(1, elf);
  si_select_package(elf);
  cl_eval(cl_list(2,
                  c_string_to_object("show-memory-layout"),
                  cl_eval(cl_list(2,
                                  c_string_to_object("read-elf"),
                                  c_string_to_object("\"hello32\"")))));
  cl_shutdown();
  return 0;
}
I can compile this file with the following

  $ gcc -o run run.c -L. -lelf -lecl

however upon execution I get the following output in which the elf
package does not seem to be present.

,----
| READ-ELF 
| Condition of type: UNDEFINED-FUNCTION
| The function ELF::READ-ELF is undefined.
| 
| No restarts available.
| 
| Top level.
| > 
`----

Ideally I'd like to be able to call the lisp functions defined in the
elf package as C functions directly in C, however I have no idea what
their names are, or how to access them from the world of C.

And advice would be greatly appreciated.

Thanks -- Eric

Footnotes: 
[1]  http://gitweb.adaptive.cs.unm.edu/elf.git

-- 
Eric Schulte
http://cs.unm.edu/~eschulte/
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a 
definitive record of customers, application performance, security 
threats, fraudulent activity and more. Splunk takes this data and makes 
sense of it. Business sense. IT sense. Common sense.. 
http://p.sf.net/sfu/splunk-d2d-c1
_______________________________________________
Ecls-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ecls-list

Reply via email to