Operating System - OpenVMS
1828221 Members
2092 Online
109975 Solutions
New Discussion

dn_expand, where resolved

 
Martin P.J. Zinser
Honored Contributor

dn_expand, where resolved

Hi,

on request of a user I am looking into the Net::DNS perl module. During the link of the module dn_expand is not found. The function is defined in resolv.h . Which shareable(s) do I miss in my link list?

Greetings, Martin
6 REPLIES 6
Martin Vorlaender
Honored Contributor

Re: dn_expand, where resolved

In resolv.h dn_expand is equated to TCPIP$DN_EXPAND, for which a global symbol exists in SYS$SHARE:TCPIP$IPC_SHR.EXE
(TCP/IP Services 5.3).

cu,
Martin
Martin Vorlaender
Honored Contributor

Re: dn_expand, where resolved

...it should, however, pick up that shareable library without having to explicitely refer to it.

A relevant passage from http://h71000.www7.hp.com/doc/73final/6529/6529pro_001.html#decc_compile could be:

>>>
To compile and link your Compaq C program using BSD Version 4.4, enter the following commands, where filename is the name of your program:

$ CC/PREFIX=ALL/DEFINE=(_SOCKADDR_LEN) filename.C
$ LINK/MAP filename
<<<

cu,
Martin
Craig A Berry
Honored Contributor

Re: dn_expand, where resolved

The comments in resolv.h say, before defining dn_expand,


/*
** The following procedures are not defined in the DECC$SHR image, but
** instead must be resolved with the TCPIP images.
**
** If the user has defined a feature test macro, __TCPIP_GLOBALS, we will
** define these functions as globals which are resolved by a TCPIP object
** library.
*/
#ifdef __TCPIP_GLOBALS


I find this a bit odd since a macro beginning with two underscores is by definition supposed to be system defined rather than user defined, but there it is. So you probably either need

$ CC/DEFINE=__TCPIP_GLOBALS

or add to the include file that comes with the extension (if any), something like:

#ifdef __VMS
# define __TCPIP_GLOBALS
#endif

and of course that would have to be somewhere the compiler would see it before processing resolv.h.
Martin P.J. Zinser
Honored Contributor

Re: dn_expand, where resolved

Hi,

thanks for the help. I did make progress to the point that I can "hand build" the module. Actually I both the __TCPIP_GLOBALS macro (goes directly into the XS code next to a similar statement for hpux ;-) and the tcpip$ip_shr.exe listed in the options file. The last one is the problem I suppose/hope Craig might be able to help with. I did try passing -L sys$share -ltcpip$ipc_share.exe as LIBS in Makefile.PL

This is kind of picked up, since perl Makefile.PL emits

Note (probably harmless): No library found for tcpip$ipc_share.exe

So how to I pass the information that I need this lib correclty to MakeMaker?

Greetings, Martin
Martin Vorlaender
Honored Contributor

Re: dn_expand, where resolved

>>>
I did try passing -L sys$share -ltcpip$ipc_share.exe as LIBS in Makefile.PL

This is kind of picked up, since perl Makefile.PL emits

Note (probably harmless): No library found for tcpip$ipc_share.exe

So how to I pass the information that I need this lib correclty to MakeMaker?
<<<

If you really did like you wrote: perhaps by specifying the correct file name tcpip$ipc_shr.exe ? ;-))

cu,
Martin
Craig A Berry
Honored Contributor

Re: dn_expand, where resolved

OK, I decided to break with custom and only give advice after actually figuring out what I'm talking about :-).

I patched the XS file as follows:

--- dns.xs;-0 Fri Dec 12 19:47:33 2003
+++ dns.xs Tue Aug 3 12:26:29 2004
@@ -15,6 +15,9 @@
#define _SYS_MAGIC_INCLUDED
#endif

+#ifdef __VMS
+# define __TCPIP_GLOBALS
+#endif

#include "EXTERN.h"
#include "perl.h"
@@ -54,7 +57,7 @@

PPCODE:
STRLEN len;
- char * buf;
+ const unsigned char * buf;
char name[MAXDNAME];
int pos;

@@ -62,7 +65,7 @@
sv_buf = SvRV(sv_buf);


- buf = SvPV(sv_buf, len);
+ buf = (const unsigned char *) SvPV(sv_buf, len);

/* This is where we do the actual uncompressing magic. */
pos = dn_expand(buf, buf+len, buf+offset, &name[0], MAXDNAME);
[end of patch]

and I generated the descrip.mms by executing the following command:

$ perl Makefile.pl "LIBS=-lsys$share:tcpip$ipc_shr.exe" --xs

and that (after running MMK) got me a clean compile and link. I passed 17 of 19 tests; I think the failures were mostly because I didn't have other prerequisites for some of the functionality.