Hi all,

I'm using Ruby/wxWindows for the application I'm currently working on, but I've been 
fooling around with Parrot for the past few days in the hope of writing some wxWindows 
bindings to test the feasability of migrating to [cardinal | perl6]/wxWindows sometime 
in the (possibly near?)future. However, I've been stymied at the first step, because I 
can get nothing but the simplest native calls to load properly... forget about the 
callbacks!

Now I realize this is truly basic, but just to establish some sanity, I'm trying to 
call the c functions defined in the attached c file, from the attached imc file. 
The output, when I uncomment one of the offending lines looks like this:

with nothing
with int 5
Segmentation fault

I've tried many different function signatures, but only the 'vv' and 'vi' seem to 
work. All of the others cause parrot to segfault when on the line that actually loads 
the function. As such, there is never even an opportunity to invoke it. 

That it happens when I try to load the function, and not invoke it would lead me to 
believe that there is something wrong with the shared library I'm generating from the 
C source, but for the life of me, I can not figure out what I could change about the 
source, or the generation of the shared object, and my knowledge of how the C world 
fits together is still... "developing".  anyhow.

I compile it like so:
gcc -fPIC -c cb.c
gcc -shared -o libcb.so cb.o
cp libcb.so runtime/parrot/dynext

I've tried to fiddle with inumerable switches even compiling it with g++ and wrapping 
it with a extern "C"{...}, as well as rearranging the order of the c-function 
declarations.

Now, I'm fairly confident that I'm doing something bone-headed because, for example, 
the PQt.C/QtHelloWorld.pasm works just fine. And of course, there is always that the 
first two function invocations work just swimmingly. But where I'm going astray has 
got me truly stumped.

Is there anyone who could help remove said bone from my head?

cheers,
Charles

___________________________________
NOCC, http://nocc.sourceforge.net

Attachment: cb.imc
Description: Binary data

void with_nothing() {
  printf("with nothing\n");
}

void with_int(const int i) {
  printf("with int %i\n", i);
}

void with_short(const short s) {
  printf("with short %i\n", s);
}

void with_float(const float f) {
  printf("with float %f\n", f);
}

void with_string(const char* message) {
  printf("with string %s", message);
}
  

Reply via email to