               <<< STAR::NOTESD$:[NOTES$LIBRARY]WIZARDS.NOTE;1 >>>
                            -<  "ASK THE WIZARDS" >-
================================================================================
Note 612.0                   Close: Solution to 586                   No replies
STAR::JKEENAN                                        93 lines   2-MAY-1996 12:36
--------------------------------------------------------------------------------
Remote Host: arica.stsci.edu
Browser Type: Mozilla/2.01 (X11; I; SunOS 5.5 sun4m)
Remote Info: <null>
Name: Nelson Zarate
Email Address: nelson@stsci.edu
CPU Architecture: VAX and Alpha
Version: v 6.2
Questions: 

> From lionel@quark.zko.dec.com Wed May  1 14:58 EDT 1996
> Date: Wed, 1 May 1996 14:50:20 -0400
> From: lionel@quark.zko.dec.com (Steve Lionel)
> To: NELSON@stsci.edu
> Subject: Your question to the OpenVMS Wizard
> X-Vms-To: nelson@stsci.edu
> 
> You asked:
> 
> >I am developing applications in a mix environment
> >(vax and axp). If I have a library pkg.olb, how do I
> >found out in an application whether this library is
> >a vax or axp one.
> 
> The library format for an .OLB is the same for VAX and Alpha, so there is
> no way to tell directly.  If you extract an object module, look at the first
> byte of the first record.  If it is an 8, it's an Alpha module, if 0, it's
> VAX.
> 
> 
> Steve Lionel                      mailto:lionel@quark.zko.dec.com
> Fortran Development               http://www.digital.com/info/slionel.html
> Digital Equipment Corporation     
> 110 Spit Brook Road, ZKO2-3/N30    
> Nashua, NH 03062-2698             "Free advice is worth every cent"
> 
> 
Hello Steve;
	Thanks for the information; but in the meantime I looked around
and I found a way to look whether an OLB is AXP or VAX.

	Here is:

/* Find if a library OLB is VAX or AXP */

#include <descrip.h>
#include <lbrdef.h>
main(argc,argv)
int argc;
char *argv[];
 
{
        unsigned long lib_index;
        char name[255];
        int  func = LBR$C_READ;
        int     status, header[128];

 
        struct dsc$descriptor_s nd;
 
	/* argv[1] contains the name of the library */

        nd.dsc$w_length = strlen(argv[1]);
        nd.dsc$a_pointer = argv[1];
        nd.dsc$b_class = DSC$K_CLASS_S;
        nd.dsc$b_dtype = DSC$K_DTYPE_T;
         status = lbr$ini_control (&lib_index, &func);
        lib$signal(status);
        status = lbr$open (&lib_index, &nd);
        lib$signal(status);
        status = lbr$get_header (&lib_index, header);
        lib$signal(status);
        printf ("%d\n", header[0]);
}

/* Header[0] is 1 for VAX and 7 for Alphas */

Cheers,

Nelson Zarate
Space Telescope Science Institute

================== RFC 822 Headers ==================
Return-Path: "VMS001::WWW"@vms001.das-x.dec.com
Received: by vmsmkt.zko.dec.com (UCX V3.3 VAX)
	Thu, 2 May 1996 09:01:00 -0400
Received: from vms001.das-x.dec.com by mail12.digital.com (5.65v3.2/1.0/WV)
	id AA31526; Thu, 2 May 1996 08:54:07 -0400
Date: Thu, 2 May 1996 08:52:24 -0400
Message-Id: <96050208522439@vms001.das-x.dec.com>
From: "VMS001::WWW"@vms001.das-x.dec.com (02-May-1996 0852)
To: sander@eng.pko.dec.com, dube@zk3.dec.com, wizard@vmsmkt.zko.dec.com
Subject: Ask the Wizard
X-Vms-To: wizard@vmsmkt.zko.dec.com
