Hi all,
I'm having trouble figuring out how to pass a string to an external C function (incidentally in a library). Library's built fine, and I can happily import/link it within BMax. However, it looks like nothing happens.
My .bmx looks like:
I put test() in test.c below, then
$ gcc -c test.c
$ ar rc test.a test.o
$ ranlib test.a
The only thing that appears to stdout is Hi there, this is a test... so:
1. How does one pass a string to an external C function from bmx?
2. Out of interest, why does the C output to stdout appear after the main (GUI) app quits? Any way of setting the buffer to flush immediately a la perl $|=1?
Cheers,
Tim
I'm having trouble figuring out how to pass a string to an external C function (incidentally in a library). Library's built fine, and I can happily import/link it within BMax. However, it looks like nothing happens.
My .bmx looks like:
Import "test.a" Extern Function test( url:String ) End Extern test( "Hi there" )
I put test() in test.c below, then
$ gcc -c test.c
$ ar rc test.a test.o
$ ranlib test.a
void test( char url[] ) { printf( "%s", "Hi there all, this is a test" ); printf( "%s", url ); }
The only thing that appears to stdout is Hi there, this is a test... so:
1. How does one pass a string to an external C function from bmx?
2. Out of interest, why does the C output to stdout appear after the main (GUI) app quits? Any way of setting the buffer to flush immediately a la perl $|=1?
Cheers,
Tim