|Subject:||Re: [Chicken-users] Implementing a C-API to a chicken library|
|Date:||Fri, 9 May 2014 19:09:55 +0200|
On Fri, 2014-05-09 at 16:56 +0200, Isak Andersson wrote:
> Basically I want to define a C API (because that's easy to call from> [...]
> all languages) that will be used on many platforms
> (ios, android, winrt, windows, osx etc).
what you want to do should indeed be possible to achieve using
define-external. However, CHICKEN's runtime system needs to be
initialized and the top-level Scheme code needs to be run before you can
call back into scheme.
> So what I did was that I created a simple test with the following> [...]
> source code:
Make the following changes:
* Replace the call of CHICKEN_initialize in src/init.c by
CHICKEN_run(C_toplevel). This will ensure that the runtime system is
initialized *and* all top-level Scheme code that may do further
initialization work has been executed once.
* Add (return-to-host) to the end of src/itest.scm. This will ensure
that the call to CHICKEN_run actually returns after all initialization
work has been completed.
Then your code should work as expected :-)
When C++ is your hammer, every problem looks like your thumb.
|[Prev in Thread]||Current Thread||[Next in Thread]|