Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Errors using DLL from Inline C with 32-bit Perl

by bliako (Monsignor)
on Jan 30, 2020 at 12:25 UTC ( [id://11112086]=note: print w/replies, xml ) Need Help??


in reply to Errors using DLL from Inline C with 32-bit Perl

Print a pointer using the appropriate formatter:

printf("%p\n", im);

It's also a good idea to check that im and tag are returned not-null after the function calls.

And also call FreeImage_GetFileType(fname, 0) on a separate line to make sure it does return a valid type too.

Then insert a lot more printf statements to see exactly which function fails.

just general debugging advice...

If it's too important then run it through a debugger (not Perl's, I mean gdb or something).

btw, to add on what syphilis said about making sure the same libraries are loaded (for Inline::C and gcc), make sure that the same compiler flags are used too. There must be a Makefile somewhere created by Inline::C (edit: for your specific script. In linux is in the same dir) which will show you exactly how the C-part of your script is compiled.

bw, bliako

Replies are listed 'Best First'.
Re^2: Errors using DLL from Inline C with 32-bit Perl
by syphilis (Archbishop) on Jan 30, 2020 at 21:53 UTC
    make sure that the same compiler flags are used too

    Good point - I now recall being tripped up by different optimization levels in the past.
    However, I think the OP has probably already followed that advice by having built the executable with:
    gcc -s -O2 -DWIN32 -fwrapv -fno-strict-aliasing -mms-bitfields -o fite +st.exe fitest.c -lfreeimage
    Maybe there's some other pertinent option that has been omitted. We can't tell unless we see the output of perl -V:ccflags

    There must be a Makefile somewhere created by Inline::C

    Also a good point - it's usually under the ./_Inline/build directory, but you'll need to configure the Inline::C script with CLEAN_AFTER_BUILD => 0 to prevent the Makefile being automatically deleted when the compilation successfully completes.

    Cheers,
    Rob

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11112086]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2024-04-19 14:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found