Closed rdaly525 closed 7 years ago
Task 1 finished in https://github.com/rdaly525/coreir/pull/29
I imagine the Python interface to look something like
ctx = Context()
stdlib = ctx.load_library("stdlib")
To do this, it could dispatch on the argument to load_library
and call the correct function coreir_stdlib.CoreIRLoadLibrary_stdlib(ctx)
but either:
extern C
function and uses the coreir-c
opaque types, orcoreir_lib.LoadLibrary(ctx, name)
which handles converting the Namespace*
and Context*
between cpp and opaque types.@leonardt In regards to #2, how does the library register itself with the C-api? I think it would still necessarily involve writing an extern C function per library. Unless I am misunderstanding something...
That being said, it would be cool to be able to register library functions which would mean no need for a specific function name standard.
@leonardt I just pushed to the clibfix branch (off of libreorg) the addition of the C stdlib api. There are three TODOs (one in lib/libs/stdlib.cpp, two in include/coreir-libs/stdlib.h)
It would be awesome if you could make macros (defined in include/coreir.h) that would macrofy each of the 3 TODOs.
Also now that we have the C api for the libs, you can add them to the python bindings
Use branch 'libreorg' in order to:
The load library call will always have a C++ function signature: Namespace CoreIRLoadLibrary_(Context c);
For example for stdlib: Namespace CoreIRLoadLibrary_stdlib(Context c);