in reply to Inline::C with minGW?

use Inline C => Config => LIBS => '-L. -lfmodex';

You don't want that - '.' (ie the current working directory) is not what you think it is. Inline changes it. Instead do:
use Inline C => Config => LIBS => '-LC:/full/path_to/lib -lfmodex';
Cheers,
Rob

Replies are listed 'Best First'.
Re^2: Inline::C with minGW?
by ikegami (Patriarch) on Oct 29, 2008 at 05:03 UTC
    So I guess that means
    use Cwd qw( realpath ); use File::Basename qw( dirname ); my $lib_path = dirname(realpath($0)); $lib_path =~ s{\\}{/}g; # Needed? And what about spaces? use Inline C => Config => LIBS => "-L$lib_path -lfmodex";
      looks like I have to add that to fixed my script.

      I am trying to improve my English skills, if you see a mistake please feel free to reply or /msg me a correction
Re^2: Inline::C with minGW?
by xiaoyafeng (Deacon) on Oct 29, 2008 at 05:42 UTC
    How Stupid I am! thanks. But does it means I can't change working directory?

    I am trying to improve my English skills, if you see a mistake please feel free to reply or /msg me a correction
      But does it means I can't change working directory?

      If you know only that the library will be in the same folder as the script, but don't know the fully-qualified location of the script and library, then you'll have to use something like the approach that ikegami showed us.

      By the way, in the example you gave in your original post, the actual working directory (from Inline's point of view) was C:\test\_Inline\build\test_pl_0ca9. The "\test\_Inline\build\" part is known in advance, and you can even configure things so that "test\_Inline" is replaced by the location of your choice. The "test_pl_0ca9" could also be determined in advance - but it will change everytime you make a change to the C code in the script.

      Cheers,
      Rob
        he "test_pl_0ca9" could also be determined in advance - but it will change everytime you make a change to the C code in the script.

        You can avoid that (the appending of hex characters to the name), by using the NAME => 'yourname' Inline option. It also make finding the generated C files easier when it comes to tracking down bugs.

        Now if only there were an option that would prevent me from making fixes in the .c file instead of the .xs and then spending 10 minutes figuring out why nothing I do seems to change the error, and we (I) would be laughing.


        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.