| From: HYDRA::AXPDEVELOPER "[email protected]" 28-FEB-1997 14:46:04.36
To: US4RMC::"[email protected]"
CC: AXPDEVELOPER
Subj: attn:Ivy Dash, information relating to the VEST translation...
Ivy Dash
This is an example, that demonstrate the problem that you have reported,
and this followed by a workaround. Please let us know if you have any
questions. Thanks for contacting Alpha developer support.
Thanks
Alpha Developer support
===============================================================================
Test program follows:
MODULE IPTEST.C
#include <stdio.h>
#include <string.h>
#include <ucx$inetdef.h>
main()
{
struct hostent *h;
static char hs_name[256];
strcpy(hs_name, "DEV1");
h - gethostbyname(hs_name);
}
COMPILE and LINK CMD
$ cc iptest.c
$ Link/Nodebug iptest,sys$share:ucx$ipc/lib
(copy iptest.exe to Alpha system from vax/vms)
$ Vest iptest
:
$ run iptest_tv
SYSTEM-F-TRANSCALLER, routine at 0058E268 cannot be called by translated code
--------------------------------------------------------------------------------
$ help/message TRANSCALLER
TRANSCALLER, routine at 'address' cannot be called by translated
code
Facility: SYSTEM, System Services
Explanation: The autojacketing routine EXE$TRANSLATED_TO_NATIVE aborted
the user program. The native routine at the specified address
cannot be called by a translated routine because the native
routine does not have a procedure signature block associated
with it.
User Action: Compile the native routine using the /TIE qualifier. The
debugger can identify the native routine by the address cited
in the message.
--------------------------------------------------------------------------------
That said, there is another way with a couple of jacket routines.
-< Process for translated image to call /Native shareable >-
--------------------------------------------------------------------------------
This process should be generally applicable when you have a translated
application which needs to call a native shareable which was *not*
built with /Tie and /NoNative
Look at the DECmigrate manual on Translating Images, particularly the
chapter titled "Translating and Replacing OpenVMS VAX Shareable Images"
There is discussion there about possibly having to edit .SIF files and
then translating the VAX shareable to generate a correct .IIF file.
The example is coded to look in the UCX database for host "seurat"
On the VAX
$ cc /noopt/deb/list ucx$ipc_shr
$ macr /deb/list ucx$ipc_shr-xfr
$ link /deb/bpage=16/map/cros/full/share ucx$ipc_shr,ucx$ipc_shr/opt
$ cc /noopt/deb/list iptest
$ link /deb/bpage=16/map/cros/full iptest,iptest/opt
Note that the program will not run correctly on the VAX as built above
Once translated, however, it works (for me, at least) on the Alpha
On the Alpha
$ copy nl: ucx$ipc_shr.sif
$ copy nl: ucx$ipc_shr.iif
$ vest/sif/iif/noexe ucx$ipc_shr
$ vest iptest
$ cc/tie/noopt/deb ucx$ipc_shr_tv/show=all/lis
The image sif2opt_tv.exe is in the DECmigrate kit, but is not installed by
default.
$ mcr sif2opt_tv ucx$ipc_shr.sif ucx$ipc_shr.opt
Edit ucx$ipc_shr.opt to include gsmatch and references to shareables
add the following to the end of the file:
sys$share:ucx$ipc_shr/shar
gsmatch=always,4,0
$ link/nonative/share ucx$ipc_shr_tv,ucx$ipc_shr/opt/deb
To run it, you'll either need to move ucx$ipc_shr_tv.exe to sys$share: or
else define a logical to point to it.
Files needed for this are given below:
--------------------------------------------------------------------------------
-< ucx$ipc_shr.c >-
--------------------------------------------------------------------------------
#include <lib$routines.h>
#include <stdlib.h>
#include <ssdef.h>
#include <ucx$inetdef.h>
#include <netdb.h>
#include <socket.h>
#include <inet.h>
#if 0
From netdb.h
#endif
struct hostent *gethostbyaddr( char *addr, int len, int type)
{
lib$signal(SS$_DEBUG);
}
struct hostent *gethostbyname( char *name)
{
lib$signal(SS$_DEBUG);
}
struct netent *getnetbyaddr( long net, int type)
{
lib$signal(SS$_DEBUG);
}
struct netent *getnetbyname( char *name)
{
lib$signal(SS$_DEBUG);
}
struct netent *getnetent()
{
lib$signal(SS$_DEBUG);
}
struct servent *getservbyname( char *name, char *proto)
{
lib$signal(SS$_DEBUG);
}
struct servent *getservbyport(int port, char *proto)
{
lib$signal(SS$_DEBUG);
}
struct protoent *getprotobyname(char *name)
{
lib$signal(SS$_DEBUG);
}
struct protoent *getprotobynumber(int proto)
{
lib$signal(SS$_DEBUG);
}
struct protoent *getprotoent()
{
lib$signal(SS$_DEBUG);
}
#if 0
From socket.h
#endif
int socket( int af, int mess_type, int prot_type)
{
lib$signal(SS$_DEBUG);
}
int accept( int sd, struct sockaddr *S_addr, int addrlen)
{
lib$signal(SS$_DEBUG);
}
int bind( int sd, struct sockaddr *s_name, int namelen)
{
lib$signal(SS$_DEBUG);
}
int listen( int sd, int backlog)
{
lib$signal(SS$_DEBUG);
}
int connect( int sd, struct sockaddr *name, int namelen)
{
lib$signal(SS$_DEBUG);
}
int send( int sd, char * msg, int length, int flags)
{
lib$signal(SS$_DEBUG);
}
int recvmsg( int sd, struct msghdr *msg, int flags)
{
lib$signal(SS$_DEBUG);
}
int sendmsg( int sd, struct msghdr * msg, int flags)
{
lib$signal(SS$_DEBUG);
}
int sendto( int sd, char * msg, int length, int flags, struct sockaddr *to, int tolen)
{
lib$signal(SS$_DEBUG);
}
int recv( int sd, char * buf, int length, int flags)
{
lib$signal(SS$_DEBUG);
}
int recvfrom( int sd, char * buf, int length, int flags, struct sockaddr *from, int *fromlen)
{
lib$signal(SS$_DEBUG);
}
int shutdown( int sd, int mode)
{
lib$signal(SS$_DEBUG);
}
int select( int nfds, int *readfds, int *writefds, int *exceptfds, struct timeval *timeout)
{
lib$signal(SS$_DEBUG);
}
int gethostname( char *name, int namelen)
{
lib$signal(SS$_DEBUG);
}
int gethostaddr( char *addr)
{
lib$signal(SS$_DEBUG);
}
int getpeername( int sd, struct sockaddr *name, int *namelen)
{
lib$signal(SS$_DEBUG);
}
int getsockname( int sd, struct sockaddr *name, int *namelen)
{
lib$signal(SS$_DEBUG);
}
int getsockopt( int sd, int level, int optname, char *optval, int *optlen)
{
lib$signal(SS$_DEBUG);
}
int setsockopt( int sd, int level, int optname, char *optval, int optlen)
{
lib$signal(SS$_DEBUG);
}
#if 0
From inet.h
#endif
int inet_addr(char *cp)
{
lib$signal(SS$_DEBUG);
}
int inet_network(char *cp)
{
lib$signal(SS$_DEBUG);
}
char *inet_ntoa(struct in_addr in)
{
lib$signal(SS$_DEBUG);
}
struct in_addr inet_makeaddr(int net, int lna)
{
lib$signal(SS$_DEBUG);
}
int inet_lnaof(struct in_addr in)
{
lib$signal(SS$_DEBUG);
}
int inet_netof(struct in_addr in)
{
lib$signal(SS$_DEBUG);
}
--------------------------------------------------------------------------------
-< ucx$ipc_shr-xfr.mar >-
--------------------------------------------------------------------------------
.psect TRANSFER,NOWRT,2
.transfer gethostbyaddr
.mask gethostbyaddr
jmp l^gethostbyaddr+2
.transfer gethostbyname
.mask gethostbyname
jmp l^gethostbyname+2
.transfer getnetbyaddr
.mask getnetbyaddr
jmp l^getnetbyaddr+2
.transfer getnetbyname
.mask getnetbyname
jmp l^getnetbyname+2
.transfer getnetent
.mask getnetent
jmp l^getnetent+2
.transfer getservbyname
.mask getservbyname
jmp l^getservbyname+2
.transfer getservbyport
.mask getservbyport
jmp l^getservbyport+2
.transfer getprotobyname
.mask getprotobyname
jmp l^getprotobyname+2
.transfer getprotobynumber
.mask getprotobynumber
jmp l^getprotobynumber+2
.transfer getprotoent
.mask getprotoent
jmp l^getprotoent+2
.transfer socket
.mask socket
jmp l^socket+2
.transfer accept
.mask accept
jmp l^accept+2
.transfer bind
.mask bind
jmp l^bind+2
.transfer listen
.mask listen
jmp l^listen+2
.transfer connect
.mask connect
jmp l^connect+2
.transfer send
.mask send
jmp l^send+2
.transfer recvmsg
.mask recvmsg
jmp l^recvmsg+2
.transfer sendmsg
.mask sendmsg
jmp l^sendmsg+2
.transfer sendto
.mask sendto
jmp l^sendto+2
.transfer recv
.mask recv
jmp l^recv+2
.transfer recvfrom
.mask recvfrom
jmp l^recvfrom+2
.transfer shutdown
.mask shutdown
jmp l^shutdown+2
.transfer select
.mask select
jmp l^select+2
.transfer gethostname
.mask gethostname
jmp l^gethostname+2
.transfer gethostaddr
.mask gethostaddr
jmp l^gethostaddr+2
.transfer getpeername
.mask getpeername
jmp l^getpeername+2
.transfer getsockname
.mask getsockname
jmp l^getsockname+2
.transfer getsockopt
.mask getsockopt
jmp l^getsockopt+2
.transfer setsockopt
.mask setsockopt
jmp l^setsockopt+2
.transfer inet_addr
.mask inet_addr
jmp l^inet_addr+2
.transfer inet_network
.mask inet_network
jmp l^inet_network+2
.transfer inet_ntoa
.mask inet_ntoa
jmp l^inet_ntoa+2
.transfer inet_makeaddr
.mask inet_makeaddr
jmp l^inet_makeaddr+2
.transfer inet_lnaof
.mask inet_lnaof
jmp l^inet_lnaof+2
.transfer inet_netof
.mask inet_netof
jmp l^inet_netof+2
.end
--------------------------------------------------------------------------------
-< ucx$ipc_shr.opt >-
--------------------------------------------------------------------------------
cluster=$my_transfer_vectors,,,ucx$ipc_shr-xfr
gsmatch=lequal,4,0
sys$share:vaxcrtl/shar
--------------------------------------------------------------------------------
-< iptest.c >-
--------------------------------------------------------------------------------
#include <stdio.h>
#include <string.h>
#include <ucx$inetdef.h>
#include <netdb.h>
main()
{
struct hostent *h;
static char hs_name[256];
strcpy(hs_name, "seurat");
h = gethostbyname(hs_name);
printf("%s\n",h->h_name);
}
--------------------------------------------------------------------------------
-< iptest.opt >-
--------------------------------------------------------------------------------
sys$disk:[]UCX$IPC_SHR/shar
sys$share:vaxcrtl/shar
--------------------------------------------------------------------------------
-< ucx$ipc_shr_tv.c >-
--------------------------------------------------------------------------------
#include <netdb.h>
#include <socket.h>
#include <inet.h>
#include <ssdef.h>
#include <lib$routines.h>
struct hostent *decc$gethostbyaddr (char *__addr, int __len, int __type);
struct hostent *decc$gethostbyname (char *__name);
struct hostent *decc$gethostent ();
struct netent *decc$getnetbyaddr (long __net, int __type);
struct netent *decc$getnetbyname (char *__name);
struct netent *decc$getnetent ();
struct servent *decc$getservbyname (char *__name, char *__proto);
struct servent *decc$getservbyport (int __port, char *__proto);
struct servent *decc$getservent ();
struct protoent *decc$getprotobyname (char *__name);
struct protoent *decc$getprotobynumber (int __proto);
struct protoent *decc$getprotoent ();
int decc$socket (int __af, int __mess_type, int __prot_type);
int decc$accept (int __sd, struct sockaddr *__S_addr, int *__addrlen);
int decc$bind (int __sd, struct sockaddr *__s_name, int __namelen);
int decc$listen (int __sd, int __backlog);
int decc$connect (int __sd, struct sockaddr *__name, int __namelen);
int decc$send (int __sd, char *__msg, int __length, int __flags);
int decc$recvmsg (int __sd, struct msghdr *__msg, int __flags);
int decc$sendmsg (int __sd, struct msghdr *__msg, int __flags);
int decc$sendto (int __sd, char *__msg, int __length, int __flags, struct sockaddr *__to, int __tolen);
int decc$recv (int __sd, char *__buf, int __length, int __flags);
int decc$recvfrom (int __sd, char *__buf, int __length, int __flags, struct sockaddr *__from, int *__fromlen);
int decc$shutdown (int __sd, int __mode);
int decc$select (int __nfds, int *__readfds, int *__writefds, int *__exceptfds, struct timeval *__timeout);
int decc$gethostname (char *__name, int __namelen);
int decc$gethostaddr (char *__addr);
int decc$getpeername (int __sd, struct sockaddr *__name, int *__namelen);
int decc$getsockname (int __sd, struct sockaddr *__name, int *__namelen);
int decc$getsockopt (int __sd, int __level, int __optname, char *__optval, int *__optlen);
int decc$setsockopt (int __sd, int __level, int __optname, char *__optval, int __optlen);
int decc$inet_addr (char *__cp);
int decc$inet_network (char *__cp);
char *decc$inet_ntoa (struct in_addr __in);
struct in_addr decc$inet_makeaddr (int __net, int __lna);
int decc$inet_lnaof (struct in_addr __in);
int decc$inet_netof (struct in_addr __in);
#if 0
From netdb.h
#endif
struct hostent *gethostbyaddr (char *__addr, int __len, int __type)
{
return (decc$gethostbyaddr (__addr, __len, __type));
}
struct hostent *gethostbyname (char *__name)
{
return (decc$gethostbyname (__name));
}
struct netent *getnetbyaddr (long __net, int __type)
{
return (decc$getnetbyaddr (__net, __type));
}
struct netent *getnetbyname (char *__name)
{
return (decc$getnetbyname (__name));
}
struct netent *getnetent ()
{
return (decc$getnetent ());
}
struct servent *getservbyname (char *__name, char *__proto)
{
return (decc$getservbyname (__name, __proto));
}
struct servent *getservbyport (int __port, char *__proto)
{
return (decc$getservbyport (__port, __proto));
}
struct protoent *getprotobyname (char *__name)
{
return (decc$getprotobyname (__name));
}
struct protoent *getprotobynumber (int __proto)
{
return (decc$getprotobynumber (__proto));
}
struct protoent *getprotoent ()
{
return (decc$getprotoent ());
}
#if 0
From socket.h
#endif
int socket (int __af, int __mess_type, int __prot_type)
{
return (decc$socket (__af, __mess_type, __prot_type));
}
int accept (int __sd, struct sockaddr *__S_addr, int *__addrlen)
{
return (decc$accept (__sd, __S_addr, __addrlen));
}
int bind (int __sd, struct sockaddr *__s_name, int __namelen)
{
return (decc$bind (__sd, __s_name, __namelen));
}
int listen (int __sd, int __backlog)
{
return (decc$listen (__sd, __backlog));
}
int connect (int __sd, struct sockaddr *__name, int __namelen)
{
return (decc$connect (__sd, __name, __namelen));
}
int send (int __sd, char *__msg, int __length, int __flags)
{
return (decc$send (__sd, __msg, __length, __flags));
}
int recvmsg (int __sd, struct msghdr *__msg, int __flags)
{
return (decc$recvmsg (__sd, __msg, __flags));
}
int sendmsg (int __sd, struct msghdr *__msg, int __flags)
{
return (decc$sendmsg (__sd, __msg, __flags));
}
int sendto (int __sd, char *__msg, int __length, int __flags, struct sockaddr *__to, int __tolen)
{
return (decc$sendto (__sd, __msg, __length, __flags, __to, __tolen));
}
int recv (int __sd, char *__buf, int __length, int __flags)
{
return (decc$recv (__sd, __buf, __length, __flags));
}
int recvfrom (int __sd, char *__buf, int __length, int __flags, struct sockaddr *__from, int *__fromlen)
{
return (decc$recvfrom (__sd, __buf, __length, __flags, __from, __fromlen));
}
int shutdown (int __sd, int __mode)
{
return (decc$shutdown (__sd, __mode));
}
int select (int __nfds, int *__readfds, int *__writefds, int *__exceptfds, struct timeval *__timeout)
{
return (decc$select (__nfds, __readfds, __writefds, __exceptfds, __timeout));
}
int gethostname (char *__name, int __namelen)
{
return (decc$gethostname (__name, __namelen));
}
int gethostaddr (char *__addr)
{
return (decc$gethostaddr (__addr));
}
int getpeername (int __sd, struct sockaddr *__name, int *__namelen)
{
return (decc$getpeername (__sd, __name, __namelen));
}
int getsockname (int __sd, struct sockaddr *__name, int *__namelen)
{
return (decc$getsockname (__sd, __name, __namelen));
}
int getsockopt (int __sd, int __level, int __optname, char *__optval, int *__optlen)
{
return (decc$getsockopt (__sd, __level, __optname, __optval, __optlen));
}
int setsockopt (int __sd, int __level, int __optname, char *__optval, int __optlen)
{
return (decc$setsockopt (__sd, __level, __optname, __optval, __optlen));
}
#if 0
From inet.h
#endif
int inet_addr (char *__cp)
{
return (decc$inet_addr (__cp));
}
int inet_network (char *__cp)
{
return (decc$inet_network (__cp));
}
char *inet_ntoa (struct in_addr __in)
{
return (decc$inet_ntoa (__in));
}
struct in_addr inet_makeaddr (int __net, int __lna)
{
return (decc$inet_makeaddr (__net, __lna));
}
int inet_lnaof (struct in_addr __in)
{
return (decc$inet_lnaof (__in));
}
int inet_netof (struct in_addr __in)
{
return (decc$inet_netof (__in));
}
|