Menu

error: redefinition of 'p_1' static const cob_pic_symbol p_1[] = {

Anonymous
2020-07-02
2020-07-02
  • Anonymous

    Anonymous - 2020-07-02

    Hi,

    I am trying to Compile, assemble, and combine all cobol files into a single dll module.

    There are lots of COBOL programs in the input. And would like to combine all of these to Prog1.dll (I hope the syntax is right) . Here I have not given true program names.

    ::text
    C:\Program Files (x86)\OpenCobolIDE\GnuCOBOL\Programs>cobc -std=ibm -b Prog1.cob Prog2.cob .. Prog10.cob
    

    after this command, I get below error

    ::text
    In file included from C:\Users\ac672600\AppData\Local\Temp\cob53388_12.c:24:0:
    C:\Users\ac672600\AppData\Local\Temp\cob53388_12.c.h:79:29: error: redefinition of 'p_1'
     static const cob_pic_symbol p_1[] = {
                                 ^
    C:\Users\ac672600\AppData\Local\Temp\cob53388_12.c.h:74:29: note: previous definition of 'p_1' was here
     static const cob_pic_symbol p_1[] = {
                                 ^
    In file included from C:\Users\ac672600\AppData\Local\Temp\cob53388_13.c:24:0:
    C:\Users\ac672600\AppData\Local\Temp\cob53388_13.c.h:23:29: error: redefinition of 'p_1'
     static const cob_pic_symbol p_1[] = {
                                 ^
    C:\Users\ac672600\AppData\Local\Temp\cob53388_13.c.h:18:29: note: previous definition of 'p_1' was here
     static const cob_pic_symbol p_1[] = {
                                 ^
    attempt to reference unallocated memory (signal SIGSEGV)
    
    cobc: aborting compile of C:/Users/ac672600/CA/rel51apr/execsrc/Prog9.cob at line 3014
    

    Another query -
    Can you also tell me the cobc command/parameter to combine all the object files into one dll file. Does -b parameter also work for input object files?

    Regards,
    Abhijeet

     

    Last edit: Simon Sobisch 2020-07-02
  • Simon Sobisch

    Simon Sobisch - 2020-07-02

    That is a reasonable thing to do and a strange error you get.

    First: Please ensure to use a current version - in this case the latest build from Arnold.
    If you still get those errors with the latest version: please provide a minimal test set and I'll fix that.

    Second: I highly suggest to not compile in any "root"/"admin" space like %ProgramFiles% or /usr/local/bin. Instead: have the sources in user space (somewhere below %USERPROFILE% or /home/) or in a separate place like a data partition.

    As you use Arnold's package (possilby the heavily outdated one):

    • open command prompt (or powershell) in the place where your sources reside
    • directly call the set_env.cmd script once to set everything up
    • then fo your compile

    Side notes:

    • if those sources are "IBM orginal" and you don't want to add newer features to it: you'll likely want -std=ibm-strict, not -std=ibm
    • if the sources are self-contained (=all CALLs targets are either in libcob [like CALL "SYSTEM" or CALL "C$GETPID"] or in the programs you combine) use -static to ensure that they are actually resolved during linking. If the generated "modules" leave into other "modules" it would be reasonable to use static linking for those that belong together by something like -K prog2 -K prog3 instead.

    To your other question: object files are directly linked into the binaries, so yes: combining them will work. You can also compile the COBOL sources to object files first and then use these later to combine into your dll.

     

    Last edit: Simon Sobisch 2020-07-02

Anonymous
Anonymous

Add attachments
Cancel