Trouble mixing C++ and Assembly code


I need to perform regester checks on RX621 RAM for which i have to mix C++ and Assembly language code.

i have found helpful documents like the IAR compiler reference guide and Renesas RX family coding guidelines.

but im stuck at a problem.

in this example from IAR compilar reference guide

0      static int sFlag;

1      void foo(void)

2      {

3      asm("mov.l #sFlag,R8");

4      asm("mov.l #PIND,R9");

5      while( !sFlag )

6      {

7      asm("mov.l [R9],[R8]");

when i try to compile this its gives errors at line 3 and 4 saying "undefined symbol sFlag" and "undefined symbol PIND"

it seems that variables declaired outside the asm("") are not being recognised from within

does anybody have any know how to do this?