Well I couldn't modify mine to work, but Thomas sent me an example in irc
on how
he got it working (https://gist.github.com/anonymous/6bd6236d741a48d03f5f).

I suppose the difference is that he used csc for everything and therefore
probably
some important flags that I didn't use were added or something like that.
Thought
I'd put it here on the mailing list for someone searching the archives for
a solution
to this problem.

Thanks Thomas! :)



On Fri, May 9, 2014 at 5:45 PM, Thomas Chust <ch...@web.de> wrote:

> 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).
> > [...]
>
> Hello Isak,
>
> 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:
> > https://gist.github.com/BitPuffin/f8ad6fa6f43327a84611
> > [...]
>
> 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 :-)
>
> Ciao,
> Thomas
>
>
> --
> When C++ is your hammer, every problem looks like your thumb.
>
>
>
>
>
_______________________________________________
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to