# The following was supposedly scribed by
# PerlDiscuss - Perl Newsgroups and mailing lists
# on Sunday 12 December 2004 07:42 am:

>Hi,
>       I am also trying to use a function inside the static library
>libX11.a - the XLookupString function. This function is declared in
>Xutil.h in the X11 directory. I used the options of LIBS => '-lX11'
> , INC => '/usr/include/X11' where the libX11.a is stored in my
> current directory. I also used #include <X11/Xutil.h> in the C
> code. But the out.Makefile.PL in the build directory says that
> -lX11 library was not found, and I get an error saying
> XLookupString is not defined. A similar C code with same
> compilation options works. Can someone help ?

Wait a second, you have libX11.a in your current directory?  I'm not 
sure if that will work, since Inline builds in a temp directory.  
Maybe try the MYEXTLIB as shown below.  That said, what follows is 
the e-mail that I had already written before having that thought...

Are you suffering from the INC bug that I found?  Maybe there is 
something of the same happening with the LIBS variable?  I was 
running into INC getting cleared if Inline::C::validate was called 
more than once.  Look in the archives for "Inline::CPP => INC 
problem" or try this diff:

$svn diff -r 295:296 external/Inline-C/Inline/C.pm
Index: external/Inline-C/Inline/C.pm
===================================================================
--- external/Inline-C/Inline/C.pm       (revision 295)
+++ external/Inline-C/Inline/C.pm       (revision 296)
@@ -1,5 +1,5 @@
 package Inline::C;
-$VERSION = '0.44';
+$VERSION = '0.45';

 use strict;
 require Inline;
@@ -43,7 +43,8 @@
     $o->{ILSM}{MAKEFILE} ||= {};
     if (not $o->UNTAINT) {
        require FindBin;
-       $o->{ILSM}{MAKEFILE}{INC} = "-I$FindBin::Bin";
+       ($o->{ILSM}{MAKEFILE}{INC} =~ m/-I$FindBin::Bin/) or
+               ($o->{ILSM}{MAKEFILE}{INC} = "-I$FindBin::Bin");
     }
     $o->{ILSM}{AUTOWRAP} = 0 if not defined $o->{ILSM}{AUTOWRAP};
     $o->{ILSM}{XSMODE} = 0 if not defined $o->{ILSM}{XSMODE};

I never got an answer when I copied Brian on this, but I see that CPAN 
still has Inline::C at 0.44.

In my CAD::Drawing::IO::DWGI.pm, I use the following for the opendwg 
(binary) library:

use Inline (
  C => Config => 
  INC => '-I/usr/local/include',
  MYEXTLIB => '/usr/local/lib/ad2.a /usr/local/lib/ad2pic.a',
  # ...
  );

Reply via email to