On Jun 24, 2010, at 12:08 PM, Craig A. Berry wrote:
.
.
.

> 
>> 4. Too many extensions like to use labels that differ only in case or 
>> reference external libraries that are built with /names=(as_is,short).  By 
>> editing 3 include files in Perl, extern.h, perl.h, and xsub.h in 
>> PERL_ROOT:[.LIB.VMS_arch.5_12_1.CORE], to set the NAMES pragma to uppercase 
>> at the beginning of the file and restore it at the end, I am able to modify 
>> the generated DESCRIP.MMS file of the extension being built to include the 
>> names=(as_is,short) switch and build the extension without difficulty.  I 
>> believe this would be worth doing as part of the standard installation.  It 
>> would also be nice if there were an option to add this switch into the 
>> generated DESCRIP.MMS automatically.
> 
> You can get /NAMES=AS_IS by configuring the Perl build with:
> 
> $ @configure -"Dbe_case_sensitive=Y" -"des"

I tried this once.  The build fails to even build miniperl.  Here I can 
reproduce this fairly quickly...

Link /NoTrace/NoMap/Trace/Exe=MINIPERL.EXE miniperlmain.obj, 
libperlmini.olb/Library/Include=globals  ,[]crtl.opt/Options
%ILINK-W-NOSUCHMOD, module GLOBALS not found
        in library USERS:[BERRYMAN.PERL-5_12_1]LIBPERLMINI.OLB;1
%ILINK-W-NUDFSYMS, 8 undefined symbols:
%ILINK-I-UDFSYM,        lib$find_image_symbol
%ILINK-I-UDFSYM,        lib$initialize
%ILINK-I-UDFSYM,        lib$rename_file
%ILINK-I-UDFSYM,        sys$filescan
%ILINK-I-UDFSYM,        sys$get_security
%ILINK-I-UDFSYM,        sys$getdviw
%ILINK-I-UDFSYM,        sys$set_security
%ILINK-I-UDFSYM,        sys$sigprc

The missing GLOBALS module is caused by the fact that, when built on an ODS-5 
disk, the filenames are all lowercase so they are entered into the library in 
lowercase.  This doesn't happen when built on an ODS-2 disk, of course, but the 
rest of the errors do.  At least some of the errors are caused by VMS.C 
undefining what it learned from the system include files and then redefining 
without the lowercase to uppercase definition the include files do.  Here is an 
extract from the MMS file I use to build libtidy, which is required by 
HTML::Tidy.  It addresses the first problem regardless of what type of build 
disk is being used.

.c.obj :
        @ if f$parse(f$search("$(MMS$SOURCE)"),,,"NAME") .nes. 
f$edit(f$parse(f$search("$(MMS$SOURCE)"),,,"NAME"),"UPCASE") then rename 
$(MMS$SOURCE) 'f$edit("$(MMS$SOURCE)","UPCASE")
        $(CC) $(DBGOPT) $(CFLAGS) $(MMS$SOURCE)

.obj.olb :
        $(LIBR)$(LIBRFLAGS) $(MMS$TARGET) $(MMS$SOURCE)

CFLAGS = 
/NAMES=(AS_IS,SHORT)/FLOAT=IEEE/IEEE=DENORM/OBJ=$(MMS$TARGET_NAME)/INCLUDE=([-.INCLUDE],[])

!++
!   Complete application - default build item
!==

COMPLETE_APPLICATION depends_on -
        libtidy.olb(access),-
        libtidy.olb(alloc),-
        libtidy.olb(attrask),-
        libtidy.olb(attrdict),-
        ...

All this does is tell MMS that, when processing a .C file into a .OBJ file, 
check to see if the filename is uppercase.  If not, rename it so it is.  The 
syntax at COMPLETE_APPLICATION tells MMS to compare the module in the library 
to the source and rebuild it if it has changed but it only works if the module 
names in the library are all uppercase (otherwise it aborts with an "action did 
not update target" error).  Would this help make Perl any more independent of 
the type of build disk being used?

> 
> xsubpp should do its own name shortening, but that can cause trouble with 
> external libraries.  I'd consider making /NAMES=(AS_IS,SHORTENED) the default 
> for 5.14.0, but need to give some thought to what will break.

xsubpp seems to shorten names declared in the XS file but it doesn't seem to 
touch names that are simply references to something external.  In the list of 
extensions I gave, there are several instances where some names are shortened 
and others are not.  This is probably a good thing because I don't know of 
anything else that uses the same shortening algorithm used in Perl.  By using 
/names=(as_is,short) in the extension build process, the names shortened by 
xsubpp are ignored but the names referencing the external library get shortened 
the same way they were when the library was built.

The difficulty with compatibility is why I suggested continuing to build Perl 
as all uppercase but modifying the Perl include files to add a names pragma.  
That way, it doesn't matter how the program referencing Perl is being built, it 
still gets all of the Perl references in the correct case.  It also means that 
the MMS files built by makefile.pl when building extensions could include 
/names=(as_is,short) by default.  The only remaining issue I know of then 
becomes whether you include a statement like 
/define="boot_XML__Parser__Expat=BOOT_XML__PARSER__EXPAT" in the build file or 
handle it in the dlsym code.

Mark Berryman

Reply via email to