Here is a Poasm example calling a MS VC module :
#define _NO_CRT_STDIO_INLINE
#include <stdio.h>
class formula {
public:
int calc(int, int, int, int, int);
void GetResult(int);
};
int formula::calc(int a, int b, int c, int d, int e)
{
return a * b * c * d * e;
}
void formula::GetResult(int t)
{
printf("The result is %u\n",t);
}
rcx points the "this" pointer, it must be skipped :
EXTERN ?calc@formula@@QEAAHHHHHH@Z:PROC
calc TEXTEQU <?calc@formula@@QEAAHHHHHH@Z>
EXTERN ?GetResult@formula@@QEAAXH@Z:PROC
GetResult TEXTEQU <?GetResult@formula@@QEAAXH@Z>
ExitProcess PROTO :QWORD
.code
start PROC PARMAREA=6*QWORD
; rcx -> this pointer
mov rdx,2
mov r8,4
mov r9,6
mov QWORD PTR [rsp+32],8
mov QWORD PTR [rsp+40],10
call calc
; rcx -> this pointer
mov rdx,rax
call GetResult
invoke ExitProcess,0
start ENDP
END start