Martin,

Pretty sure this only works with Metal C.  Inline assembly code requires the 
GENASM compiler option which is only valid in combination with the METAL 
option.  Otherwise __asm is ignored.  Personally, I think that is a bad design, 
it should not be simply ignored but would at least generate a warning.  

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/cbclr1b0/7.8
http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/CBCUG1A0/4.53
   
See the end of this post for instructions on using the ibm-mail list server 
list.  You'll get better response since only a few folks may be using the 
google mirror of the postings.

Cheers.

-- forwarded post --

Dear all, 

I try to test using a __asm statement in my C++ program. I simply like to add 
to values (x and y) and print this output. 
But it will not do so. x and y is alway the same. 

--- begin of code --- 
// test_inline.C 
#include <sstream> 
#include <iostream> 
#include <fstream> 

using namespace std; 
        
                  
// MAIN 
int main(int argc, char *argv[]) 
{ 
 int rc=0; 
 int x=9; 
 int y=7; 

 printf("%s %s\nBEFOR: x=%d y=%d\n",__DATE__,__TIME__,x,y);         
  
 __asm ( "AR %0,%1\n" : "=r"(x) : "r"(y),"0"(x) );  // output, input, register 
define - none here done by compiler 
              
 printf("AFTER: x=%d y=%d\n",x,y);         
 exit(rc); 
} 

--- end of code --- 

Make: 
c++ -o test_inline -g -Wc,xplink -Wl,xplink test_inline.C 

Now if I run this in the USS the output is as following 
>./test_inline 
May  1 2014 09:25:31 
BEFOR: x=9 y=7 
AFTER: x=9 y=7 
> 

does anybody can give me a hint whats wrong here ? 

Best Regards, 
Martin

----------------------------------------------------------------------
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