![]() |
![]() HP OpenVMS Systemsask the wizard |
![]() |
The Question is: HELP! - > I can't get smg$read_string() to work from C. Every time I call it, my program crashes with an access violation. I have carefully examined each argument against what the manual specifies and they each appear correct. The smg$ manual, however, shows no examples in C (isn't that sorta odd?). Could you show me how to use this system service from C? Maybe you could point me to some smg$ programming examples in C. Thanks a bunch, John E. Frank The Answer is : Without seeing the failing source code, it is difficult to say exactly what has happened. The ACCVIO message contains information on exactly what the cause of the access violation was, including the failing program counter address, the virtual address that the access attempt failed on, and whether or not the request was a read or a write. Among the more common causes of program failures in C programs written by programmers new to C on OpenVMS involve string descriptors -- either the incorrect specification of a string descriptor correctly, or failure to (correctly) pass the string descriptor by reference. (Those programmers new to C on OpenVMS, and thus new to string descriptors, should start by practicing various calls to the lib$put_output library call.) There are obviously many other potential causes of an access violation. There are far too many library routines and far too may system services to make examples of each routine in a particular language available. See the OpenVMS Frequently Asked Questions (FAQ) for pointers to example source code areas, such as the Freeware CD-ROM. On the DISK$FREEWAREV30 distribution, look under [EMON021-3] and [GOPHER] for example C source code that calls SMG. There are other examples of calls to SMG available from a variety of sources, including (if you have a software support contract) DSNlink.
|