[Info-vax] C... the only winning move is not to play...

VAXman- at SendSpamHere.ORG VAXman- at SendSpamHere.ORG
Sun Feb 9 21:09:14 EST 2014


In article <ld95me$397$1 at dont-email.me>, Stephen Hoffman <seaohveh at hoffmanlabs.invalid> writes:
>On 2014-02-09 23:17:04 +0000,   VAXman-  @SendSpamHere.ORG said:
>
>> I've encountered a VMS library call prototype that is incorrect.  How 
>> can I override/overwrite the prototype in my source to make it correct? 
>>  I've used other routines from this library without issue save for this 
>> one.  Is there a #pragma that allows for or provides this?  I've read 
>> the on-line help but don't see anything under #pragma.
>
>I'm assuming this is a VMS header for the system or for an RTL, and 
>probably something that was generated via SDL.
>
>Hack it.  Extract the header file, fix it, and either insert it back 
>under the same name, insert under a different name and #include 
><foodef-other.h>, or pull it in via a #include "mylocalcopy.h" syntax.  
>  This where the file was either edited directly, or maybe regenerated 
>via SDL processing on the SDI file from STARLETSD.TLB.
>
>You could probably also do a symbol name fix-up via a patch or using 
>some linker arcana, but that's more work than its worth.
>
>If you wanted to be slightly sneaky (and depending on the particular 
>call and the OpenVMS version), declare your replacement as a function 
>pointer under a different name and use a call to lib$find_image_symbol 
>to find the virtual address of the "real" function, and jump to that.
>
>No, VMS C doesn't have anything akin to --wrap or related baggage 
><http://wwwold.cs.umd.edu/Library/TRs/CS-TR-4585/CS-TR-4585.pdf>, and 
>the closest analog to the preloading (the lib$initialize psect) 
>wouldn't seem to get you closer to your goal.
>
>Document the shenanigans locally for the code, and dispatch a bug 
>report along to HP so that you can record the bug report number in the 
>comments.

Grrr... I have to build against VMS version variants back to V7.2 for this
particular project.

I guess that what I will do is make this code "fuglier" to work around the
bad prototype.  The problem is basically an RTL with two mandatory args and 
a litany of optional args.  The C prototype only defines the two mandatory
args; it should have a third __optional_params in the prototype but, sadly,
it's been elided.

Strong typing is for weak minds!

-- 
VAXman- A Bored Certified VMS Kernel Mode Hacker    VAXman(at)TMESIS(dot)ORG

Well I speak to machines with the voice of humanity.



More information about the Info-vax mailing list