QNX RTOS v4 Knowledge Base
QNX RTOS v4 Knowledge Base
Title |
Compiling inline assembly code in a C application |
Ref. No. |
QNX.000005711 |
Category(ies) |
Development |
Issue |
We want to write an inline assembly code but could not make it work. This function converts a floating point number into a long integer. Here is the code.
long ftol (float v) { long rv; asm { fld v fistp rv } return rv; }
We could not compile it.
|
Solution |
The assembly code needs to be all on one line. You can use the / to make it look like it is all on one line. Then you need to put the assembly commands between double quotes (") and separated them by a coma (,).
Please look in the helpviewer for more information. The examples can be found in: x09Watcom 10.6 x09Compiler & Tools User's Guide x09In-line assembly language
|
|