Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hello,

I have a Perl program that uses two modules, Socket and Pg (postgres). We need to send a copy of the program to a sister-company and want to ensure that they can't fiddle with the program so would like to compile it.

Using perlcc I conversion to C and object code works great. However, the linker produces the following errors:
/tmp/ccQB49cU.o: In function `dl_init': /tmp/ccQB49cU.o(.text+0xef8d0): undefined reference to `boot_Pg' /tmp/ccQB49cU.o(.text+0xef986): undefined reference to `boot_Socket' collect2: ld returned 1 exit status
Any ideas any how to solve the problem?
Thanks,
Gavin

Replies are listed 'Best First'.
Re: Problems linking code produced by perlcc
by Helter (Chaplain) on Nov 01, 2002 at 15:53 UTC
    Define boot_Pg and boot_Socket.

    *Ba' Dum' Bum! symbol clash*

    A code snippet might help here, are you using strict and warnings, that might weed out your problem.

    Are these variables you have defined elsewhere and only use in this file?

    Are you using my or local?

    The key to getting a good answer, is asking a good question.

      The program starts:
      #!/usr/bin/perl use Socket; use Pg; use NetAddr::IP;
      There are no other use or require lines. Strict and warnings is not being used.

      The program uses both my and local variables.

      The functions boot_Pg and boot_Socket are not defined in my program. It looks like they are meant to auto-generated functions to initialise each library. They are called from the dl_init C function of the generated C code.

      Thanks again, Gavin
Re: Problems linking code produced by perlcc
by chromatic (Archbishop) on Nov 01, 2002 at 18:01 UTC