home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.os.vms      DEC's VAX* line of computers & VMS.      264,096 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 263,446 of 264,096   
   =?UTF-8?Q?Arne_Vajh=C3=B8j?= to Craig A. Berry   
   Re: Cross gcc targeting VMS   
   29 Sep 25 19:58:51   
   
   From: arne@vajhoej.dk   
      
   On 9/29/2025 5:18 PM, Craig A. Berry wrote:   
   > On 9/29/25 3:01 PM, hb0815 wrote:   
   >> On 9/29/25 18:17, Waldek Hebisch wrote:   
   >>> Now about troubles.  VMS C functions use different name at C level   
   >>> and different in libraries.  Moreover, while offically function is   
   >>> available in "imagelib.olb", actual function is in a different library   
   >>> and this library is needed for succesful linking.  So, one needs   
   >>> to know real name of a given function and teach gcc to use it.   
   >>   
   >> Yes, for example, printf in the source code is changed  to   
   >> DECC$GXPRINTF in the object module. DECC$GXPRINTF is a symbol in the   
   >> shareable image library IMAGELIB.OLB. Symbols in a library must be   
   >> unique. That explains the DECC$ prefix. I don't know what the GX means   
   >> or where it comes from. I also don't know where the mapping/   
   >> replacement table is.   
   >>   
   >> IMAGELIB.OLB contains only the symbol and a link to the shareable   
   >> image. The actual code (and data) is in the shareable image, not in a   
   >> library. So if you link using IMAGELIB.OLB you link with DECC$SHR. At   
   >> least on Alpha, the symbol DECC$GXPRINTF is also in STARLET.OLB. By   
   >> default this OLB is not used, by default you dynamically link and not   
   >> statically. Do a link on VMS/Alpha with a map file. In the map you   
   >> will only see DECC$SHR, no STARLET.OLB and no IMAGELIB.OLB.   
   >   
   > Surely GXPRINTF knows how to format G_FLOAT numbers and there would be   
   > other versions for X_FLOAT, D_FLOAT, etc.?   
      
   I believe GXPRINTF means F+G+X.   
      
   (which is a weird combo but C on VMS Alpha does not support H)   
      
   My reason:   
      
   $ type fpp.c   
   #include    
      
   int main()   
   {   
        float s = 1.0;   
        printf("%f\n", s);   
        double d = 1.0;   
        printf("%f\n", s);   
        long double q = 1.0;   
        printf("%Lf\n", q);   
        return 0;   
   }   
   $ cc /list /mach /float=d_float /l_double=64 fpp   
   $ link fpp   
   $ run fpp   
   1.000000   
   1.000000   
   1.000000   
   $ sear fpp.lis decc$,printf /match=and   
   6B5A4000     00E0               JSR     R26, DECC$DPRINTF   
           ; R26, R26   
   6B5A4000     00F8               JSR     R26, DECC$DPRINTF   
           ; R26, R26   
   6B5A4000     0110               JSR     R26, DECC$DPRINTF   
           ; R26, R26   
                 0030               .LINKAGE DECC$DPRINTF   
   $ cc /list /mach /float=g_float /l_double=64 fpp   
   $ link fpp   
   $ run fpp   
   1.000000   
   1.000000   
   1.000000   
   $ sear fpp.lis decc$,printf /match=and   
   6B5A4000     00E0               JSR     R26, DECC$GPRINTF   
           ; R26, R26   
   6B5A4000     00F8               JSR     R26, DECC$GPRINTF   
           ; R26, R26   
   6B5A4000     0110               JSR     R26, DECC$GPRINTF   
           ; R26, R26   
                 0030               .LINKAGE DECC$GPRINTF   
   $ cc /list /mach /float=ieee_float /l_double=64 fpp   
   $ link fpp   
   $ run fpp   
   1.000000   
   1.000000   
   1.000000   
   $ sear fpp.lis decc$,printf /match=and   
   6B5A4000     00E0               JSR     R26, DECC$TPRINTF   
           ; R26, R26   
   6B5A4000     00F8               JSR     R26, DECC$TPRINTF   
           ; R26, R26   
   6B5A4000     0110               JSR     R26, DECC$TPRINTF   
           ; R26, R26   
                 0030               .LINKAGE DECC$TPRINTF   
   $ cc /list /mach /float=d_float /l_double=128 fpp   
   $ link fpp   
   $ run fpp   
   1.000000   
   1.000000   
   1.000000   
   $ sear fpp.lis decc$,printf /match=and   
   6B5A4000     00E0               JSR     R26, DECC$DXPRINTF   
           ; R26, R26   
   6B5A4000     00F8               JSR     R26, DECC$DXPRINTF   
           ; R26, R26   
   6B5A4000     0120               JSR     R26, DECC$DXPRINTF   
           ; R26, R26   
                 0030               .LINKAGE DECC$DXPRINTF   
   $ cc /list /mach /float=g_float /l_double=128 fpp   
   $ link fpp   
   $ run fpp   
   1.000000   
   1.000000   
   1.000000   
   $ sear fpp.lis decc$,printf /match=and   
   6B5A4000     00E0               JSR     R26, DECC$GXPRINTF   
           ; R26, R26   
   6B5A4000     00F8               JSR     R26, DECC$GXPRINTF   
           ; R26, R26   
   6B5A4000     0120               JSR     R26, DECC$GXPRINTF   
           ; R26, R26   
                 0030               .LINKAGE DECC$GXPRINTF   
   $ cc /list /mach /float=ieee_float /l_double=128 fpp   
   $ link fpp   
   $ run fpp   
   1.000000   
   1.000000   
   1.000000   
   $ sear fpp.lis decc$,printf /match=and   
   6B5A4000     00E0               JSR     R26, DECC$TXPRINTF   
           ; R26, R26   
   6B5A4000     00F8               JSR     R26, DECC$TXPRINTF   
           ; R26, R26   
   6B5A4000     0120               JSR     R26, DECC$TXPRINTF   
           ; R26, R26   
                 0030               .LINKAGE DECC$TXPRINTF   
      
   Arne   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca