My task is to connect a separate assembler procedure to the c++ code. I use Dev-C++ for writing.
There is an example of a task that doesn't work for me.
//file1.cpp
#include <iostream>
extern "C" int MAS_FUNC (int *, int);
int main()
{
int *mas,n,k;
n=5;
mas=new int[n];
for (int i=0; i < n; i=i+1)
{
mas[i]=i;
}
k = MAS_FUNC(mas,n);
}
;file2.asm
.586
.MODEL FLAT, C
.CODE
MAS_FUNC PROC C mas:dword, n:dword
mov esi,mas
mov eax, [esi+4]
shl eax, 1
type here
ret
MAS_FUNC ENDP
END
I don't really understand how everything should work, but I just put .cpp and .asm in the same folder. (And this is probably wrong, because in VS it seems like you need to connect some kind of masm, etc.) At startup.cpp throws this error ...undefined reference to `MAS_FUNC. I didn't find any guides on Dev-C++, so I'm writing here how to make it work.