Re: How do one return a fullword binary to a C program from an assembler subroutine?

2024-04-17 Thread Willy Jensen
Thanks Bernd, yes I did wonder about that, I will fix it. Willy -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Re: How do one return a fullword binary to a C program from an assembler subroutine?

2024-04-17 Thread Willy Jensen
Thanks Peter, worked like a charm and makes the program much simpler. Now I just wonder why it is neccessary to use a specific pointer specification for int fields and not for char fields. Anyway, it works. Willy -- For

Re: How do one return a fullword binary to a C program from an assembler subroutine?

2024-04-17 Thread Bernd Oppolzer
The program has one more problem: buffer overrun in this statement:   char hlicmd[8];   ...   strcpy (hlicmd, "VGET    "); the variable hlicmd has 8 bytes, but the strcpy copies 9 bytes, the string VGET, 4 blanks and the terminating hex zero :-( take care !!! HTH, kind regards Bernd Am

Re: How do one return a fullword binary to a C program from an assembler subroutine?

2024-04-17 Thread Bernd Oppolzer
The reason behind this is: C passes arguments "by value", which means that int arguments like textlen are passed directly as values, not as addresses. You get the value 120 in the address list, pointed to by reg 1, not the address of textlen, which is different from COBOL or FORTRAN etc (COBOL

Re: How do one return a fullword binary to a C program from an assembler subroutine?

2024-04-16 Thread Farley, Peter
Willy, You don’t actually need the textlenp variable for the call to the subroutine, you can just pass the ADDRESS of textlen directly with this syntax: retcode = rxhlicpl (hlicmd, name, namelen, text, ); Unless of course you also need that pointer for some other process later. Peter From:

Re: How do one return a fullword binary to a C program from an assembler subroutine?

2024-04-16 Thread Willy Jensen
Kirh, thank you for your alternate solution, I will keep that in mind. Willy -- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Re: How do one return a fullword binary to a C program from an assembler subroutine?

2024-04-16 Thread Kirk Wolf
Willy, Lots of info here, but not the essential bits: what addressing mode and linkage convention would you like to use? I'll choose to answer for 31-bit C and assembler where the assembler is standard savearea linkage. This will work from either C/C++ using XPLINK or non-XPLINK. In C:

Re: How do one return a fullword binary to a C program from an assembler subroutine?

2024-04-16 Thread Willy Jensen
Found it, it was down to C pointers as expected / feared. This works, note the use of 'textlenp' in the call: #pragma linkage (rxhlicpl, OS) main () { extern int rxhlicpl();

Re: How do one return a fullword binary to a C program from an assembler subroutine?

2024-04-16 Thread Willy Jensen
Thanks Tony, yes I am at the 'I just want it to work stage'. I do actually have a "#pragma linkage(rxhlicpl,OS)" statement in there, should have listed that as well. I would really prefer not to get involved with LE at this point, but if that is what it takes, then I guess I have to. Your idea

Re: How do one return a fullword binary to a C program from an assembler subroutine?

2024-04-16 Thread Tony Harminc
It depends to some extent on how much you want to learn about C and LE linkage conventions. If the answer is "nothing at all - I just want it to work", then you might want to try inserting a #pragma linkage(rxhlicpl,OS) which tells the compiler to use an OS-style argument list when it calls your

How do one return a fullword binary to a C program from an assembler subroutine?

2024-04-16 Thread Willy Jensen
Anybody have a sample of how to return a fullword to a C program from an assembler subroutine? Apologies if this seems basic, but I really haven't looked seriously at C before. I have read about 'Combining C or C++ and Assembler programs', which didn't help. I have this C program (extract):