Re: Calling External DLL functions in Perl using Inline



Sisyphus wrote:
> <ben.sommer@xxxxxxx>
> >
> >
> > Hi All.
> >
> > I'm just wondering how this problem resolved for you, Sankaran. I have
> > the (almost) exact same problem, though my environment is cygwin+gcc.
>
> Brian McCauley suggested the specific problem to which you allude was the
> result of trying to process C++ source code with the compiler in C mode. If
> that's so (and I've seen a couple of other posts suggesting the same thing)
> then I think the solution would be to either convert the C++ source to C, or
> use Inline::CPP.
>
> With gcc, you need to be compiling C++ code with g++, not gcc - so if,
> during the installation of Inline::CPP, you're prompted for which compiler
> to use, make sure that g++ is specified.
>
> So ..... I guess the advice is for you to use Inline::CPP if the source is
> C++. If the source is C and you're still getting those errors, then let us
> know.
>
> > The user32.dll example from the Inline docs works flawlessly for me as
> > well.
>
> That's C code, so one would expect no problem there.
>
> >Also, for my application, any conceivable permutation of the INC
> > or LIBS directives (and windows/cygwin LIB/INC/PATH environment
> > variables) always results in this:
> >
> > Note (probably harmless): No library found for '-lMyLib'
> >
>
> Sometimes that warning actually *is* harmless - I see it from time to time,
> but I only ever take notice of it whenever 'MyLib' is not found.
>
> If the lib is not being found, have you tried:
> LIBS => '-L/full_path/to_MyLib -lMyLib',

Oh yes. Like I said, I've tried every concveivable permutation.

> If you specify '-lMyLib', will gcc find a file called 'MyLib.a', or will it
> find only a file named 'libMyLib.a' ? (I think it will find either, but you
> might check on that in case there's a problem there.)
>
> Let us know how you get on with this.

A gracious response Rob. Many thanks.

Well, you pointed out an inconsistency: my .lib and .dll files don't
have .a extension. I gratuitously added one and the "No library found"
error dissapeared. How annoying. I grokked the gcc man page and see
what you mean about library file extensions (and prepensions). I'll
send a note to the Inline::C author asking him to include a caveat in
the section of his docs that talks about DLLs.

Cygwin is sometimes confusing, kinda windows, kinda unix. Sometimes
case sensitive, sometimes not.

Best,

--
Ben Sommer
Senior Technology Officer
Eastern Nazarene College
23 East Elm Ave
Quincy, MA 02170

.