I’ve got yet another error trying to compile with Apple GCC 4.2.1 using the -fasm-blocks argument (which enables Intel style assembly syntax) inline assembly code which worked in MSVC: block assembly operand not recognized, label ‘LASM$TYPE’ used but not defined:
typedef struct _MyStruct
{
int data;
//...
}MyStruct;
void testAsm()
{
MyStruct *pMyStruct = new MyStruct(); // Please not that I create an instance of MyStruct here only for the sake of simplicity
_asm
{
mov edi, pMyStruct
add edi, TYPE MyStruct // error: block assembly operand not recognized. label 'LASM$TYPE' used but not defined
//...
};
delete pMyStruct;
}
How can I fix this problem?
TYPEis an MSVC-specificasmkeyword. Here it just meanssizeof. I tried to find some gcc asm-block documentation on the web, but I gave up after ten minutes. Tryand variants. I don’t have an Apple, so I can’t try it out for you.
Updated to answer question in comment: Try this:
If it doesn’t work, see “Using the GNU Compiler Collection” for documentation.