extern "OS" (*entryPoint)(const char *) is the correct declaration for C++.

I have called OS linkage functions from the CVT in C++ without problems. Where is the header file for CSRSI?

Are you XPLINK?


On 17/07/2012 10:10 AM, Charles Mills wrote:
Another way of saying what I am trying to do is what you do if you are
calling from C++ any MVS callable service or something like that using the
pointer somewhere off of the CVT.

Looking at the header file for CSRSI it looks like perhaps you can't do it
from C++.

Charles

-----Original Message-----
From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] On
Behalf Of Charles Mills
Sent: Monday, July 16, 2012 5:14 PM
To: IBM-MAIN@LISTSERV.UA.EDU
Subject: How call from C++ thru function pointer to assembler?

Does anyone know the answer to this?

I have an assembler function whose address I know at run-time in C++. I
define and store it like this

void __cdecl (*entryPoint)(const char *);
entryPoint = (void (__cdecl *)(const char *))(myVoidStar);
printf("entryPoint is %p\n", entryPoint);

Printf prints the correct address (DFFD058, FWIW) so I am good so far.

I then call it with
(entryPoint)(record);

and I end up S0C6ing out in the weeds at 27F5023B.

Here is the pseudo-assembler from the C++ compiler.

4400  C1AC        000114 |                 EX       r0,HOOK..STMT
5870  D0C0        000114 |                 L        r7,record(,r13,192)
5810  D0C8        000114 |                 L        r1,#CEECAACRENT_2(,
5880  35DA        000114 |                 L        r8,=Q(entryPoint)(,
4118  1000        000114 |                 LA       r1,=Q(entryPoint)(r
5810  1000        000114 |                 L        r1,entryPoint(,r1,0
58F0  1008        000114 |                 L        r15,&EPA_&WSA(,r1,8
5800  100C        000114 |                 L        r0,&EPA_&WSA(,r1,12
5000  C1F4        000114 |                 ST       r0,_CEECAA_(,r12,50
4110  D098        000114 |                 LA       r1,#MX_TEMP2(,r13,1
5070  D098        000114 |                 ST       r7,#MX_TEMP2(,r13,1
4400  C1C0        000114 |                 EX       r0,HOOK..CALLBGN
0DEF              000114 |                 BASR     r14,r15
4400  C1C4        000114 |                 EX       r0,HOOK..CALLRET

Does anyone know what I should be declaring or doing differently?

(If all else fails I will just write a stub in assembler to do this. I know
how to L 15 BALR 14,15 in assembler <g>.)

Charles

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to