HP OpenVMS Systems

ask the wizard
Content starts here

BASIC and TCP/IP Services?

» close window

The Question is:

We are trying to migrate from a serial connect to TCPIP under HP Basic.
We are on OpenVMS 7.31, TCPIP 5.3, HP Basic 1.4 all running on an Alpha Server
We believe we are successfully converting "C" code examples found on the Web to
 Basic, but hit a problem converting a String IP Address to the QIO 'p3' format.
Examples have shown that a call to the C function INET_ADDR should work.
 However we have problems in linking to the TCPIP library.
My source code is as follows (program YYYY.BAS):
        external string function inet_addrstring by ref)
        declare string w$
When linked using the following:
YYYY.OPT contains:
We receive the following error:
%LINK-W-USRTFR, image SYSDSK:[USERS.TPRICE]YYYY.EXE;30 has no user transfer
I'm sure it is a silly on my part, but nevertheless am stumped.

The Answer is :

  When calling from BASIC, please use the $qio[w] interface
  and not the C socket library.  The C socket library is not
  intended to be called from other languages.  While $qio[w]
  might initially appear more intimidating, it is far better
  suited for mixed-language programming.
  If you wish to learn about string descriptors and about C
  null-terminated ASCII strings (ASCIZ strings), please see the
  OpenVMS FAQ, the calling standard documentation, and the C
  In particular, ASCIZ strings must have a null termination byte,
  and strings (typically using string descriptors) managed by
  BASIC, Fortran or other languages do not necessarily nor
  reliably provide the trailing null byte.
  The LINKER USRTFR error indicates that there is no starting
  module for the image.  You will want to provide an object
  module (directly, or extracted from an object library as
  part of the LINKER command) as a starting point for the
  execution of the code.
  If you do persist in calling the C RTL from a program that
  does not have a C main program, please see and use the C
  RTL initialization call.  (This call is intended for non-C
  programs that call C routines, not non-C calls into the
  C RTL -- again, this is unsupported.  Initialization of
  the C RTL is necessary here, however.)
  There should be examples of calling various services from
  BASIC in the AskQ library, and a pointer to AskQ is present
  in the OpenVMS FAQ in the section discussing finding source
  code examples.

answer written or last revised on ( 10-MAR-2004 )

» close window