Because I prefer Visual Studio editor instead of Keil and IAR editors, I tried to compile ARM based projects using VS 2017. A project includes RTL.h header of RealView Run-Time Library which declares Software Interrupt (SWI) functions. As I understand Visual C++ compiler supports SWI intrinsic function but I'm getting compile errors.
Also I tried this in a main-only application compiling using default compiler and Clang compiler too - both of Visual Studio:
1: void __swi(1) test1();
2: void __swi_2 test2();
3:
4: void test3() __swi(3);
5: void test4() __swi_4;
6:
7: __swi(5) test5();
8: __swi_6 void test6();
The errors generated by default Visual C++ compiler are:
Line 1
- Error C2182 '__swi': illegal use of type 'void'
- Error C2146 syntax error: missing ';' before identifier 'test1'
- Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int
Line 2
- Error C2182 '__swi_2': illegal use of type 'void'
- Error C2146 syntax error: missing ';' before identifier 'test2'
- Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int
Line 4
- Error C3646 '__swi': unknown override specifier
- Error C2059 syntax error: '('
Line 5
- Error C3646 '__swi_4': unknown override specifier
Line 7
- Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int
- Error C2374 '__swi': redefinition; multiple initialization
- Error C2146 syntax error: missing ';' before identifier 'test5'
Line 8
- Error C2144 syntax error: 'void' should be preceded by ';'
- Error C4430 missing type specifier - int assumed. Note: C++ does not support default-int
Is Visual C++ compiler capable to recognize these declarations? If yes, what should be changed?