Wow! Fast answer, and looked very promising, but no change in behavior. Added DLL(CBA) to my options.
Charles -----Original Message----- From: IBM Mainframe Discussion List [mailto:[email protected]] On Behalf Of David Crayford Sent: Monday, July 16, 2012 5:19 PM To: [email protected] Subject: Re: How call from C++ thru function pointer to assembler? I suggest investigating the CALLBACKANY compiler option. On 17/07/2012, at 8:13 AM, Charles Mills <[email protected]> wrote: > 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? ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN
