[Info-vax] Any Way to Pass Character String Arguments from C to Basic?

John Reagan xyzzy1959 at gmail.com
Mon Oct 21 16:27:06 EDT 2019


On Monday, October 21, 2019 at 12:19:42 PM UTC-7, Craig Dedo wrote:
> On Monday, October 21, 2019 at 1:25:52 PM UTC-5, John Reagan wrote:
> > On Monday, October 21, 2019 at 9:18:10 AM UTC-7, Robert A. Brooks wrote:
> > > On 10/21/2019 11:31 AM, Craig Dedo wrote:
> > >  
> > > 
> > > > Everything compiles and links correctly; no errors or warnings at all.
> > > > When I run the program everything works fine until I try to assign character string data back into character string arguments> that are associated with character strings in the C program.
> > > > * Assignment of character string arguments from the C program to variables in the Basic subroutine works fine.
> > > > * Assignment of integer results from the Basic subroutine to the integer arguments in the C program works fine.
> > > 
> > > > * BUT when I try to assign character string values to a character string argument in the C program, I get a fatal error:
> > > > %STR-F-FATINTERR, fatal internal error
> > >  To be clear, you get this error not when you are calling the BASIC subroutine, but when you attempt to do the string assignment in the C source
> > > prior to calling the BASIC subroutine?
> > >  
> > > Let's see the C actual source.
> > > 
> > > I don't see this support call in our internal bug tracking system yet.
> > >  
> > > -- 
> > > 
> > >                       -- Rob
> > 
> > Like Rob, I want to see the C code that is building the descriptor and that you are building a CLASS_D, not a CLASS_S.  Plus the descriptor needs to be writeable since the BASIC code (via the STR$ routines) will want to update it.
> > 
> > And who says descriptors make things easier?
> 
> As you asked, here are the three descriptor definitions.
> 
> struct dsc$descriptor_d Customer_Location_Code_ldsc = { sizeof (Customer_Location_Code_lsz) - 1, DSC$K_DTYPE_T, DSC$K_CLASS_D,  Customer_Location_Code_lsz };
> 
> struct dsc$descriptor_d Oldest_Invoice_Number_ldsc = { sizeof (Oldest_Invoice_Number_lsz) - 1, DSC$K_DTYPE_T, DSC$K_CLASS_D, Oldest_Invoice_Number_lsz };
> 
> struct dsc$descriptor_d Part_Number_ldsc = { sizeof (Part_Number_lsz) - 1, DSC$K_DTYPE_T, DSC$K_CLASS_D, Part_Number_lsz };
> 
> Sincerely, 
> Craig T. Dedo. OpenVMS Software Development Consultant 
> Navistar, Inc. 
> 2701 Navistar Drive 
> Lisle, IL   60532

For CLASS_D, consider what happens if one of those STR$ routines needs to extend the string...  It will allocate new memory, copy the bytes as needed, and then attempt to free the existing buffer pointed to by the descriptor...  And that's what you hit.

For CLASS_D, you have to let the underlying routines manage the data completely.




More information about the Info-vax mailing list