----- Original Message ----- From: "Brian Hammond" <[EMAIL PROTECTED]> To: <inline@perl.org> Sent: Tuesday, October 04, 2005 12:50 AM Subject: Mac OS X
> > I am trying to autowrap a C library called GLFW using Inline C (0.44) on Mac > OS X. [snip] > http://brianhammond.com/perl/GLFW.pm Haven't used AUTOWRAP before, and was interested to take a look at it. Perhaps there are flaws in what follows. I see in the '.pm' file reference to non-standard C types such as: void glfwSetWindowSizeCallback( GLFWwindowsizefun cbfun ); Does inline treat that correctly for you ? For standard C types there's no problem, but for non-standard types (on Win32 at least) 'autowrap' doesn't know what to do with non-standard types when it comes to writing the XS file .... and fails to do the right thing. I tried: ### simple .h ### #define simple_double double double simple(simple_double d); ############## ### libsimple.c ### #include "simple.h" double simple(simple_double d) {return d * 2;} ############### Then built libsimple.a by running in succession: gcc -c libsimple.c ar rc libsimple.a libsimple.o ranlib libsimple.a Then tried the perl script: ### simple.pl ### use warnings; use Inline C => Config => BUILD_NOISY => 1, CLEAN_AFTER_BUILD => 0, ENABLE => AUTOWRAP => LIBS => '-LD:/C -lsimple'; use Inline C => q{ #include "D:/C/simple.h" double simple(simple_double); }; print simple(1.032); #line 13 ####################### It compiled ok but produced the perl runtime error: Use of inherited AUTOLOAD for non-method main::simple() is deprecated at simple.pl line 13. Can't locate auto/main/simple.al in @INC (@INC contains: D:\pscrpt\inline\special\_Inline\lib D:/perl58_M/5.8.7/lib D:/perl58_M/site/5.8.7/lib D:/perl58_M/site/lib .) at simple.pl line 13 When I go into the build directory and take a look at the XS file that was generated I find: #include "EXTERN.h" #include "perl.h" #include "XSUB.h" #include "INLINE.h" #include "D:/C/simple.h" double simple(simple_double); MODULE = simple_pl_f685 PACKAGE = main PROTOTYPES: DISABLE There's *nothing* below the 'PROTOTYPES: DISABLE' line (because, I presume, Inline doesn't know what to do with the 'simple_double' type) ... and that's not right. One way to fix that may be to write a typemap specifying how to deal with any non-standard types. (Or there might be a simpler solution to this issue that I'm unaware of.) If you haven't already, I certainly think it would be a good idea to check that you can get 'AUTOWRAP' working correctly with a simple library (that contains at least one non-standard type). If you can get over any hurdles with that, you'll be in much better shape when it comes to tackling the actual library you're interested in. Or maybe even forego 'AUTOWRAP' in favour of *manually* wrapping the functions. Cheers, Rob