[Info-vax] Any Way to Pass Arrays of Strings from C to Basic?
Stephen Hoffman
seaohveh at hoffmanlabs.invalid
Wed Nov 13 11:59:05 EST 2019
On 2019-11-13 16:17:58 +0000, Neil Rieck said:
>
> As others have already mentioned, this can be simple or hard depending
> upon what you are trying to do. Having said that, you will find simple
> and complex examples here (search: Hybrid Programming)
>
> http://neilrieck.net/demo_vms_html/openvms_demo_index.html
>
> Hybrid Demo-5 takes things to extremes. Here, I wrote some code to deal
> with a VMS-BASIC program which calls a DEC-c routine to connect to
> MySQL. The data strings returned from MySQL are copied into a
> BASIC-declared array-of-strings.
I'd prototype a cached open, and allow each record to be returned
separately through a simpler API.
That largely uses the existing API, and can potentially speed other
operations sharing the cached open.
This is the same design as used when opening an RMS file, and reading
or writing records.
Beyond the design and test overhead and particularly around probing
access to all the references inherent in an itemlist or with an array
of descriptors, the run-time overhead of building up hundreds or
thousands of entries or potentially more in some big data structure,
and then tearing it all down, is not small.
Yeah, looping through the array, or looping through one massive call.
Both have relatively similar programming overhead. The latter also has
to deal with the entire volume of data, in aggregate.
And it pushes that design and that complexity into every current and
all future callers.
Which is one of my gripes about string descriptors in general.
Descriptors expose details of the API and the compatibility where that
really shouldn't happen.
A very close look at whether some 16- or 32-bit limit will be reached
here, whether sooner or maybe later.
The one-terabyte P0 isn't as big as it used to be, after all.
That all depends greatly on the data, and on the data volume in
aggregate, and on details such as virtual addressing and pagefile sizes
and 32-bit address space.
Now if I really have to deal with that volume of data, I'm also going
to look at using an RMS file (maybe YAML, maybe SQLite, etc), and also
at using a ginormous blob of data that gets passed back to the caller.
At scale, this requirement isn't far off trying to manage a partial
database export. Through an API that tries to unmarshal the query from
the database and then re-marshal the export for the API, and pushes
another unmarshal off into the caller.
Depending on the specifics of the text data and future plans, also at
whether non-ASCII, non-MCS, maybe UTF-8 character data might arrive,
too.
Embedding magic strings in arrays doesn't necessarily end well, too.
The other approach is to push the whole search query operation closer
to the database itself. Or link the two databases more closely, maybe
periodically exporting the necessary from one to the other, or from
both into a third. Wading out of these database design and aggregation
messes can take many years, and at no small investment.
--
Pure Personal Opinion | HoffmanLabs LLC
More information about the Info-vax
mailing list