public inbox for libffi-discuss@sourceware.org
 help / color / mirror / Atom feed
* Passing function pointer to fcall
@ 2011-11-27  0:06 wp1068189-ssc
  2011-11-27  4:05 ` Anthony Green
  0 siblings, 1 reply; 6+ messages in thread
From: wp1068189-ssc @ 2011-11-27  0:06 UTC (permalink / raw)
  To: libffi-discuss


Please take a look at this piece of code:
 
#include <stdio.h>
#include <ffi.h>
#include <stdlib.h>

int msg(void (*a) (char *)) {
    return 23;
    // but this doesn't work :-(
    a("Hi, there !\n");
}

int main(int argc, char ** argv)
    {


    ffi_cif cif;
    ffi_abi abi;
    ffi_status status;
    int nargs = 1;
    ffi_type *rtype = &ffi_type_uint32;
    ffi_type **atypes;
    void **avalues;
    void *result;

    atypes = malloc(sizeof(ffi_type));
    atypes[0] = &ffi_type_pointer;

    avalues = malloc(sizeof(ffi_type_pointer));
    // I want to call msg with a pointer to printf
    *(void**)avalues[0] = printf;

    status = ffi_prep_cif(&cif, FFI_DEFAULT_ABI, nargs, rtype, atypes);

    result = (ffi_type *) malloc(sizeof(rtype->size));

    if(status != FFI_OK)
        printf("ffi_prep_cif failed (%i)\n",status);

    ffi_call(&cif,FFI_FN(msg),result,avalues);

    return(*(int *)result);
    }
 
As you might imagine, I'd like to call a function "msg" and send it a pointer to
printf,
but that does not work.
I guess it has to do with the pointer me is constructing.
 
But I have absolutely no idea what I'm doing wrong.
 
Can anyone help, please ? 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Passing function pointer to fcall
  2011-11-27  0:06 Passing function pointer to fcall wp1068189-ssc
@ 2011-11-27  4:05 ` Anthony Green
  2011-11-27  7:33   ` wp1068189-ssc
  0 siblings, 1 reply; 6+ messages in thread
From: Anthony Green @ 2011-11-27  4:05 UTC (permalink / raw)
  To: libffi-discuss

On 11/26/2011 7:05 PM, wp1068189-ssc wrote:
> Please take a look at this piece of code:
>   
> #include<stdio.h>
> #include<ffi.h>
> #include<stdlib.h>
>
> int msg(void (*a) (char *)) {
>      return 23;
>      // but this doesn't work :-(
>      a("Hi, there !\n");
> }
>
> int main(int argc, char ** argv)
>      {
>
>
>      ffi_cif cif;
>      ffi_abi abi;
>      ffi_status status;
>      int nargs = 1;
>      ffi_type *rtype =&ffi_type_uint32;
>      ffi_type **atypes;
>      void **avalues;
>      void *result;
>
>      atypes = malloc(sizeof(ffi_type));
>      atypes[0] =&ffi_type_pointer;
>
>      avalues = malloc(sizeof(ffi_type_pointer));
>      // I want to call msg with a pointer to printf
>      *(void**)avalues[0] = printf;
>
>      status = ffi_prep_cif(&cif, FFI_DEFAULT_ABI, nargs, rtype, atypes);
>
>      result = (ffi_type *) malloc(sizeof(rtype->size));
>
>      if(status != FFI_OK)
>          printf("ffi_prep_cif failed (%i)\n",status);
>
>      ffi_call(&cif,FFI_FN(msg),result,avalues);
>
>      return(*(int *)result);
>      }
>   
> As you might imagine, I'd like to call a function "msg" and send it a pointer to
> printf,
> but that does not work.
> I guess it has to do with the pointer me is constructing.
>   
> But I have absolutely no idea what I'm doing wrong.
>   
> Can anyone help, please ?


Let's get the obvious one of out the way... you are returning from msg() 
before calling the function.

I'm going to assume that's a typo or something.

What platform are you working on?  Also, you should declare "a" in msg() 
to have the same prototype as printf.

Also, there's an oddity in the libffi API, and that is that "result" 
needs to be the largest native integral type on your system.  So, use a 
long for result instead of mallocing the exact return type size.  You 
can pass it into ffi_call as &result and simply cast it to an int at the 
end.

Anthony Green

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Passing function pointer to fcall
  2011-11-27  4:05 ` Anthony Green
@ 2011-11-27  7:33   ` wp1068189-ssc
  2011-11-27 14:12     ` Stefan Sonnenberg-Carstens
  0 siblings, 1 reply; 6+ messages in thread
From: wp1068189-ssc @ 2011-11-27  7:33 UTC (permalink / raw)
  To: Anthony Green, libffi-discuss

Hi,

I was not a type, it was by intention.
The code looked originally so:

#include<stdio.h>
#include<ffi.h>
#include<stdlib.h>

int msg(void (*a) (char *)) {
     a("Hi, there !\n");
     return 23;
}
int main(int argc, char ** argv)
     {
     ffi_cif cif;
     ffi_abi abi;
     ffi_status status;
     int nargs = 1;
     ffi_type *rtype =&ffi_type_uint32;
     ffi_type **atypes;
     void **avalues;
     void *result;

     atypes = malloc(sizeof(ffi_type));

     atypes[0] =&ffi_type_pointer;
     avalues = malloc(sizeof(ffi_type_pointer));

     // I want to call msg with a pointer to printf

     *(void**)avalues[0] = printf;
     status = ffi_prep_cif(&cif, FFI_DEFAULT_ABI, nargs, rtype, atypes);
     result = (ffi_type *) malloc(sizeof(rtype->size));

     if(status != FFI_OK)
         printf("ffi_prep_cif failed (%i)\n",status);

      ffi_call(&cif,FFI_FN(msg),result,avalues);
      return(*(int *)result);
      }

I'm on Windows XP SP2, with mingw:
gcc -v
COLLECT_GCC=C:\MinGW\bin\gcc.exe
COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/mingw32/4.6.1/lto-wrapper.exe
Ziel: mingw32
Konfiguriert mit: ../gcc-4.6.1/configure
--enable-languages=c,c++,fortran,objc,obj-c++ --disable-sjlj-exceptions --with-
dwarf2 --enable-shared --enable-libgomp --disable-win32-registry
--enable-libstdcxx-debug --enable-version-specific-runt
ime-libs --build=mingw32 --prefix=/mingw
Thread-Modell: win32
gcc-Version 4.6.1 (GCC)

libffi is 3.0.10 build and installed with ./configure && make && make install

The example above is compiled this way:

gcc dyn_callback.c libffi-5.dll -I /lib/libffi-3.0.10/include/ -o dyn_callback

On your suggestion I changed the code a bit, so that result get alloc'd this
way:

result = (ffi_type *) malloc(long);

Simple: if I execute the program, nothing happens.
If I comment out the line

     a("Hi, there !\n");

I get back 23 by $? after execution.
If it is there, I get 5.

I'm stuck.


Anthony Green <green@moxielogic.com> hat am 27. November 2011 um 05:05
geschrieben:

> On 11/26/2011 7:05 PM, wp1068189-ssc wrote:
> > Please take a look at this piece of code:
> >   
> > #include<stdio.h>
> > #include<ffi.h>
> > #include<stdlib.h>
> >
> > int msg(void (*a) (char *)) {
> >      return 23;
> >      // but this doesn't work :-(
> >      a("Hi, there !\n");
> > }
> >
> > int main(int argc, char ** argv)
> >      {
> >
> >
> >      ffi_cif cif;
> >      ffi_abi abi;
> >      ffi_status status;
> >      int nargs = 1;
> >      ffi_type *rtype =&ffi_type_uint32;
> >      ffi_type **atypes;
> >      void **avalues;
> >      void *result;
> >
> >      atypes = malloc(sizeof(ffi_type));
> >      atypes[0] =&ffi_type_pointer;
> >
> >      avalues = malloc(sizeof(ffi_type_pointer));
> >      // I want to call msg with a pointer to printf
> >      *(void**)avalues[0] = printf;
> >
> >      status = ffi_prep_cif(&cif, FFI_DEFAULT_ABI, nargs, rtype, atypes);
> >
> >      result = (ffi_type *) malloc(sizeof(rtype->size));
> >
> >      if(status != FFI_OK)
> >          printf("ffi_prep_cif failed (%i)\n",status);
> >
> >      ffi_call(&cif,FFI_FN(msg),result,avalues);
> >
> >      return(*(int *)result);
> >      }
> >   
> > As you might imagine, I'd like to call a function "msg" and send it a
> > pointer to
> > printf,
> > but that does not work.
> > I guess it has to do with the pointer me is constructing.
> >   
> > But I have absolutely no idea what I'm doing wrong.
> >   
> > Can anyone help, please ?
>
>
> Let's get the obvious one of out the way... you are returning from msg()
> before calling the function.
>
> I'm going to assume that's a typo or something.
>
> What platform are you working on?  Also, you should declare "a" in msg()
> to have the same prototype as printf.
>
> Also, there's an oddity in the libffi API, and that is that "result"
> needs to be the largest native integral type on your system.  So, use a
> long for result instead of mallocing the exact return type size.  You
> can pass it into ffi_call as &result and simply cast it to an int at the
> end.
>
> Anthony Green
>
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Passing function pointer to fcall
  2011-11-27  7:33   ` wp1068189-ssc
@ 2011-11-27 14:12     ` Stefan Sonnenberg-Carstens
  2011-12-07 12:01       ` Anthony Green
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Sonnenberg-Carstens @ 2011-11-27 14:12 UTC (permalink / raw)
  To: wp1068189-ssc; +Cc: Anthony Green, libffi-discuss

So, I extended the program some more:

#include <stdio.h>
#include <ffi.h>
#include <stdlib.h>
#include <windows.h>

int add(int a,int b, char *fmt,void *fn) {
    // int (*func)(char *,int) = (int (*)(char
*,int))GetProcAddress(GetModuleHandle("msvcrt.dll"),fn);
    int (*func)(char *,int) = (int (*)(char *,int))fn;
    return func(fmt,a+b);
}

int main(void)
    {

    ffi_cif cif;
    ffi_abi abi;
    ffi_status status;
    int nargs = 4;
    ffi_type *rtype = &ffi_type_sint32;
    ffi_type *atypes[4];
    void *avalues[4];
    int result;

    int a,b;
    a = 3;
    b = 4;

    char *fmt = "The answer is %i\n";
    char *fn  = "printf";

    atypes[0] = &ffi_type_sint32;
    atypes[1] = &ffi_type_sint32;
    atypes[2] = &ffi_type_pointer;
    atypes[3] = &ffi_type_pointer;

    avalues[0] = malloc(atypes[0]->size);
    avalues[1] = malloc(atypes[1]->size);

    *(int *) avalues[0] = a;
    *(int *) avalues[1] = b;
    avalues[2] = (char *) &fmt;
    avalues[3] = &printf;

    printf("direct call: %i",add(3,4,"erg: %i\n",&printf));

    status = ffi_prep_cif(&cif, FFI_DEFAULT_ABI, nargs, rtype, atypes);

    if(status != FFI_OK)
        printf("ffi_prep_cif failed (%i)\n",status);

    // crash occurs somewhere near here ...
    ffi_call(&cif,FFI_FN(add),&result,avalues);

    printf("%i\n",result);

    return 0 ;

    }


As you can see, I call my add function twice, once directly
and once via ffi_call.
Both times I pass a reference to printf.
As the direct method works, I guess the principal code is OK.

Now, when I run the program it shows:

$ dyn_callback.exe
erg: 7
direct call: 7

Then it crashes and creates this callstack:

dyn_callback.exe caused an Access Violation at location 614c25ff Reading
from location 614c25ff.

Registers:
eax=614c25ff ebx=0040138c ecx=00000000 edx=00000003 esi=45206472 edi=6085db86
eip=614c25ff esp=0022fe34 ebp=0022fe60 iopl=0         nv up ei pl nz na pe nc
cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00000202

Call stack:
AddrPC     AddrReturn AddrFrame  AddrStack  Params
614C25FF   004013AF   0022FE30   0022FE34   00403064   00000007   77C35C94
  77C12580
614C25FF
004013AF   6B746957   0022FE60   0022FE34   00000003   00000004   00403064
  614C25FF
004013AF  dyn_callback.exe:004013AF  add  dyn_callback.c:10

	...
	    int (*func)(char *,int) = (int (*)(char *,int))fn;
	    return func(fmt,a+b);
>	}

	int main(void)
	...

6B746957   6B7465AF   0022FE78   0022FE34   6B746298   0022FEB4   00000010
  00000001
6B746957  libffi-6.dll:6B746957  ffi_call_win32
6B7465AF   004014FB   0022FEC8   0022FE34   0022FF20   0040138C   0022FEFC
  0022FF00
6B7465AF  libffi-6.dll:6B7465AFC:\MinGW\msys\1.0\local\bin\libffi-6.dll:
No symbol found
  ffi_call
004014FB   004010B9   0022FF58   0022FE34   00000001   005B2C98   005B2ED0
  00405004
004014FB  dyn_callback.exe:004014FB  main  dyn_callback.c:53

	...
	    ffi_call(&cif,FFI_FN(add),&result,avalues);

>	    printf("%i\n",result);

	    return 0 ;
	...

004010B9   00401284   0022FFA0   0022FE34   00000001   A47CBD08   7C90DCBA
  7C817064
004010B9  dyn_callback.exe:004010B9  __mingw_CRTStartup  crt1.c:244

00401284   7C817067   0022FFC0   0022FE34   6085DB86   45206472   7FFDA000
  C0000005
00401284  dyn_callback.exe:00401284  WinMainCRTStartup  crt1.c:274

7C817067   00000000   0022FFF0   0022FE34   0040126C   00000000   00000000
  00000000
7C817067  kernel32.dll:7C817067
C:\WINDOWS\system32\kernel32.dll: No symbols
  RegisterWaitForInputIdle
DEBUG_EVENT:
	dwDebugEventCode = EXIT_PROCESS_DEBUG_EVENT
	dwProcessId = CCC
	dwThreadId = A30
	dwExitCode = C0000005

I installed libffi 3.0.11 beforhand, but sadly it produces no debugging
symbols.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Passing function pointer to fcall
  2011-11-27 14:12     ` Stefan Sonnenberg-Carstens
@ 2011-12-07 12:01       ` Anthony Green
  2011-12-07 13:19         ` wp1068189-ssc
  0 siblings, 1 reply; 6+ messages in thread
From: Anthony Green @ 2011-12-07 12:01 UTC (permalink / raw)
  To: stefan.sonnenberg; +Cc: libffi-discuss

Stefan,

   The problem below is "avalues[3] = &printf".  You need to add one 
more level of indirection.. so...

void *p = printf;
  and
avalues[3] = &p;

AG


On 11/27/2011 9:12 AM, Stefan Sonnenberg-Carstens wrote:
> So, I extended the program some more:
>
> #include<stdio.h>
> #include<ffi.h>
> #include<stdlib.h>
> #include<windows.h>
>
> int add(int a,int b, char *fmt,void *fn) {
>      // int (*func)(char *,int) = (int (*)(char
> *,int))GetProcAddress(GetModuleHandle("msvcrt.dll"),fn);
>      int (*func)(char *,int) = (int (*)(char *,int))fn;
>      return func(fmt,a+b);
> }
>
> int main(void)
>      {
>
>      ffi_cif cif;
>      ffi_abi abi;
>      ffi_status status;
>      int nargs = 4;
>      ffi_type *rtype =&ffi_type_sint32;
>      ffi_type *atypes[4];
>      void *avalues[4];
>      int result;
>
>      int a,b;
>      a = 3;
>      b = 4;
>
>      char *fmt = "The answer is %i\n";
>      char *fn  = "printf";
>
>      atypes[0] =&ffi_type_sint32;
>      atypes[1] =&ffi_type_sint32;
>      atypes[2] =&ffi_type_pointer;
>      atypes[3] =&ffi_type_pointer;
>
>      avalues[0] = malloc(atypes[0]->size);
>      avalues[1] = malloc(atypes[1]->size);
>
>      *(int *) avalues[0] = a;
>      *(int *) avalues[1] = b;
>      avalues[2] = (char *)&fmt;
>      avalues[3] =&printf;
>
>      printf("direct call: %i",add(3,4,"erg: %i\n",&printf));
>
>      status = ffi_prep_cif(&cif, FFI_DEFAULT_ABI, nargs, rtype, atypes);
>
>      if(status != FFI_OK)
>          printf("ffi_prep_cif failed (%i)\n",status);
>
>      // crash occurs somewhere near here ...
>      ffi_call(&cif,FFI_FN(add),&result,avalues);
>
>      printf("%i\n",result);
>
>      return 0 ;
>
>      }
>
>
> As you can see, I call my add function twice, once directly
> and once via ffi_call.
> Both times I pass a reference to printf.
> As the direct method works, I guess the principal code is OK.
>
> Now, when I run the program it shows:
>
> $ dyn_callback.exe
> erg: 7
> direct call: 7
>
> Then it crashes and creates this callstack:
>
> dyn_callback.exe caused an Access Violation at location 614c25ff Reading
> from location 614c25ff.
>
> Registers:
> eax=614c25ff ebx=0040138c ecx=00000000 edx=00000003 esi=45206472 edi=6085db86
> eip=614c25ff esp=0022fe34 ebp=0022fe60 iopl=0         nv up ei pl nz na pe nc
> cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000             efl=00000202
>
> Call stack:
> AddrPC     AddrReturn AddrFrame  AddrStack  Params
> 614C25FF   004013AF   0022FE30   0022FE34   00403064   00000007   77C35C94
>    77C12580
> 614C25FF
> 004013AF   6B746957   0022FE60   0022FE34   00000003   00000004   00403064
>    614C25FF
> 004013AF  dyn_callback.exe:004013AF  add  dyn_callback.c:10
>
> 	...
> 	    int (*func)(char *,int) = (int (*)(char *,int))fn;
> 	    return func(fmt,a+b);
>> 	}
> 	int main(void)
> 	...
>
> 6B746957   6B7465AF   0022FE78   0022FE34   6B746298   0022FEB4   00000010
>    00000001
> 6B746957  libffi-6.dll:6B746957  ffi_call_win32
> 6B7465AF   004014FB   0022FEC8   0022FE34   0022FF20   0040138C   0022FEFC
>    0022FF00
> 6B7465AF  libffi-6.dll:6B7465AFC:\MinGW\msys\1.0\local\bin\libffi-6.dll:
> No symbol found
>    ffi_call
> 004014FB   004010B9   0022FF58   0022FE34   00000001   005B2C98   005B2ED0
>    00405004
> 004014FB  dyn_callback.exe:004014FB  main  dyn_callback.c:53
>
> 	...
> 	    ffi_call(&cif,FFI_FN(add),&result,avalues);
>
>> 	printf("%i\n",result);
> 	return 0 ;
> 	...
>
> 004010B9   00401284   0022FFA0   0022FE34   00000001   A47CBD08   7C90DCBA
>    7C817064
> 004010B9  dyn_callback.exe:004010B9  __mingw_CRTStartup  crt1.c:244
>
> 00401284   7C817067   0022FFC0   0022FE34   6085DB86   45206472   7FFDA000
>    C0000005
> 00401284  dyn_callback.exe:00401284  WinMainCRTStartup  crt1.c:274
>
> 7C817067   00000000   0022FFF0   0022FE34   0040126C   00000000   00000000
>    00000000
> 7C817067  kernel32.dll:7C817067
> C:\WINDOWS\system32\kernel32.dll: No symbols
>    RegisterWaitForInputIdle
> DEBUG_EVENT:
> 	dwDebugEventCode = EXIT_PROCESS_DEBUG_EVENT
> 	dwProcessId = CCC
> 	dwThreadId = A30
> 	dwExitCode = C0000005
>
> I installed libffi 3.0.11 beforhand, but sadly it produces no debugging
> symbols.
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Passing function pointer to fcall
  2011-12-07 12:01       ` Anthony Green
@ 2011-12-07 13:19         ` wp1068189-ssc
  0 siblings, 0 replies; 6+ messages in thread
From: wp1068189-ssc @ 2011-12-07 13:19 UTC (permalink / raw)
  To: Anthony Green; +Cc: libffi-discuss

I did figure this out already.
Anyway thanks alot.
 
Just a few days away newLisp 10.3.8 will be released - and then bring support
for
libffi on Windows, Linux and Mac OS. 


Anthony Green <green@moxielogic.com> hat am 7. Dezember 2011 um 13:01
geschrieben:

> Stefan,
>
>    The problem below is "avalues[3] = &printf".  You need to add one
> more level of indirection.. so...
>
> void *p = printf;
>   and
> avalues[3] = &p;
>
> AG
>
>
> On 11/27/2011 9:12 AM, Stefan Sonnenberg-Carstens wrote:
> > So, I extended the program some more:
> >
> > #include<stdio.h>
> > #include<ffi.h>
> > #include<stdlib.h>
> > #include<windows.h>
> >
> > int add(int a,int b, char *fmt,void *fn) {
> >      // int (*func)(char *,int) = (int (*)(char
> > *,int))GetProcAddress(GetModuleHandle("msvcrt.dll"),fn);
> >      int (*func)(char *,int) = (int (*)(char *,int))fn;
> >      return func(fmt,a+b);
> > }
> >
> > int main(void)
> >      {
> >
> >      ffi_cif cif;
> >      ffi_abi abi;
> >      ffi_status status;
> >      int nargs = 4;
> >      ffi_type *rtype =&ffi_type_sint32;
> >      ffi_type *atypes[4];
> >      void *avalues[4];
> >      int result;
> >
> >      int a,b;
> >      a = 3;
> >      b = 4;
> >
> >      char *fmt = "The answer is %i\n";
> >      char *fn  = "printf";
> >
> >      atypes[0] =&ffi_type_sint32;
> >      atypes[1] =&ffi_type_sint32;
> >      atypes[2] =&ffi_type_pointer;
> >      atypes[3] =&ffi_type_pointer;
> >
> >      avalues[0] = malloc(atypes[0]->size);
> >      avalues[1] = malloc(atypes[1]->size);
> >
> >      *(int *) avalues[0] = a;
> >      *(int *) avalues[1] = b;
> >      avalues[2] = (char *)&fmt;
> >      avalues[3] =&printf;
> >
> >      printf("direct call: %i",add(3,4,"erg: %i\n",&printf));
> >
> >      status = ffi_prep_cif(&cif, FFI_DEFAULT_ABI, nargs, rtype, atypes);
> >
> >      if(status != FFI_OK)
> >          printf("ffi_prep_cif failed (%i)\n",status);
> >
> >      // crash occurs somewhere near here ...
> >      ffi_call(&cif,FFI_FN(add),&result,avalues);
> >
> >      printf("%i\n",result);
> >
> >      return 0 ;
> >
> >      }
> >
> >
> > As you can see, I call my add function twice, once directly
> > and once via ffi_call.
> > Both times I pass a reference to printf.
> > As the direct method works, I guess the principal code is OK.
> >
> > Now, when I run the program it shows:
> >
> > $ dyn_callback.exe
> > erg: 7
> > direct call: 7
> >
> > Then it crashes and creates this callstack:
> >
> > dyn_callback.exe caused an Access Violation at location 614c25ff Reading
> > from location 614c25ff.
> >
> > Registers:
> > eax=614c25ff ebx=0040138c ecx=00000000 edx=00000003 esi=45206472
> > edi=6085db86
> > eip=614c25ff esp=0022fe34 ebp=0022fe60 iopl=0         nv up ei pl nz na pe
> > nc
> > cs=001b  ss=0023  ds=0023  es=0023  fs=003b  gs=0000           
> >  efl=00000202
> >
> > Call stack:
> > AddrPC     AddrReturn AddrFrame  AddrStack  Params
> > 614C25FF   004013AF   0022FE30   0022FE34   00403064   00000007   77C35C94
> >    77C12580
> > 614C25FF
> > 004013AF   6B746957   0022FE60   0022FE34   00000003   00000004   00403064
> >    614C25FF
> > 004013AF  dyn_callback.exe:004013AF  add  dyn_callback.c:10
> >
> >         ...
> >             int (*func)(char *,int) = (int (*)(char *,int))fn;
> >             return func(fmt,a+b);
> >>         }
> >         int main(void)
> >         ...
> >
> > 6B746957   6B7465AF   0022FE78   0022FE34   6B746298   0022FEB4   00000010
> >    00000001
> > 6B746957  libffi-6.dll:6B746957  ffi_call_win32
> > 6B7465AF   004014FB   0022FEC8   0022FE34   0022FF20   0040138C   0022FEFC
> >    0022FF00
> > 6B7465AF  libffi-6.dll:6B7465AFC:\MinGW\msys\1.0\local\bin\libffi-6.dll:
> > No symbol found
> >    ffi_call
> > 004014FB   004010B9   0022FF58   0022FE34   00000001   005B2C98   005B2ED0
> >    00405004
> > 004014FB  dyn_callback.exe:004014FB  main  dyn_callback.c:53
> >
> >         ...
> >             ffi_call(&cif,FFI_FN(add),&result,avalues);
> >
> >>         printf("%i\n",result);
> >         return 0 ;
> >         ...
> >
> > 004010B9   00401284   0022FFA0   0022FE34   00000001   A47CBD08   7C90DCBA
> >    7C817064
> > 004010B9  dyn_callback.exe:004010B9  __mingw_CRTStartup  crt1.c:244
> >
> > 00401284   7C817067   0022FFC0   0022FE34   6085DB86   45206472   7FFDA000
> >    C0000005
> > 00401284  dyn_callback.exe:00401284  WinMainCRTStartup  crt1.c:274
> >
> > 7C817067   00000000   0022FFF0   0022FE34   0040126C   00000000   00000000
> >    00000000
> > 7C817067  kernel32.dll:7C817067
> > C:\WINDOWS\system32\kernel32.dll: No symbols
> >    RegisterWaitForInputIdle
> > DEBUG_EVENT:
> >         dwDebugEventCode = EXIT_PROCESS_DEBUG_EVENT
> >         dwProcessId = CCC
> >         dwThreadId = A30
> >         dwExitCode = C0000005
> >
> > I installed libffi 3.0.11 beforhand, but sadly it produces no debugging
> > symbols.
> >
>
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-12-07 13:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-27  0:06 Passing function pointer to fcall wp1068189-ssc
2011-11-27  4:05 ` Anthony Green
2011-11-27  7:33   ` wp1068189-ssc
2011-11-27 14:12     ` Stefan Sonnenberg-Carstens
2011-12-07 12:01       ` Anthony Green
2011-12-07 13:19         ` wp1068189-ssc

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).