Hi, I decided to try assembly inserts in KN. As su...
# kotlin-native
r
Hi, I decided to try assembly inserts in KN. As suggested, it is possible to write them in
def
. Great, I found examples of usage http://asmcourse.cs.msu.ru/wp-content/uploads/2013/04/gcc-inline-asm.pdf https://ru.stackoverflow.com/questions/829868/%D0%90%D1%81%D1%81%D0%B5%D0%BC%D0%B1%D0%BB%D0%B5%D1%80%D0%BD%D0%B0%D1%8F-%D0%B2%D1%81%D1%82%D0%B0%D0%B2%D0%BA%D0%B0-%D0%B2-%D0%A1%D0%B8 but an error crashes: <inline asm>211: error: unknown token in expression mov eax, %ecx ^ <inline asm>311: error: unknown token in expression add eax, %edx ^ <inline asm>46: error: unknown token in expression mov %ecx, eax ^ LLVM ERROR: Error parsing inline asm Prompt is a mistake in the syntax or you still can not do so. This is the
def
file itself: --- #include <windows.h> #include <stdio.h> #include <tchar.h> int prin() { int a = 1; int b = 2; int c; __asm(".intel_syntax noprefix\n\t" // директива GAS, включаем Intel синтаксис. "mov eax, %1\n\t" // перемещаем в eax значение переменной a. "add eax, %2\n\t" // прибавляем значение переменной b к eax. "mov %0, eax\n\t" // перемещаем в переменную c значение eax. :"=r"(c) // список выходных параметров. :"r"(a), "r"(b) // список входных параметров. : "eax" // список разрушаемых регистров. ); printf("%d + %d = %d\n", a, b, c); return 0; }
o
Please avoid posting such long dumps to Slack. It is not suitable.
r
Oh sure i will take note
s
This issue is likely to be completely unrelated to Kotlin/Native.
cinterop
accepts valid C code compilable with
clang
, so please try to compile this code with
clang
first .