<- Back | Index | Forward ->
DaySWIG
Daylight provides C and Fortran interfaces to their Toolkit, but none
for Python, Perl, Tcl, etc.. Luckily, these languages provide ways to
interface with C and C++ functions.
That's where DaySWIG comes in:
- Converts the C header files into SWIG interface definition,
- Automatically generates interface code (for many languages)
- Well, not fully automatic:
- Assumes strings are NUL terminated
- The invalid string problem
- dt_setstring(handle, name, NULL) <--> dt_setstring_invalid
- Depict library is "the other way"
- Compile the interface, link with libdt_* and produce a shared library
C code:
dt_Integer handle = dt_cansmiles(4, "COO");
dt_Integer datatype = dt_type(handle);
dt_dealloc(handle);
Python equivalent:
from dayswig_python import *
handle = dt_cansmiles("COO")
datatype = dt_type(handle)
dt_dealloc(handle)