I am trying link an .asm file into my kernel mode driver

I am developing a kernel mode windows driver and I need to use float functions from an .asm file, but I get errors. The .cpp file also seems to not be able to find the extern asm functions.

What I did:
I set build customizations to masm(.targets, .props)
I created a new file with .asm extension and with these command line options:
ml64.exe

I included the .asm file in my .cpp file
I did this for extern function and the cpp cannot find the asm function:
1
2
3
4
5
6
7
8
extern "C" {
	float __sqrtf(float);
	float __sinf(float);
	float __cosf(float);
	float __tanf(float);
	float __atan2f(float, float);
};

The errors:
1
2
3
4
5
6
7
8
9
10
11
12
13
14

Severity	Code	Description	Project	File	Line	Suppression State
Error	MSB3721	The command "ml64.exe /c /nologo /Zi /Fo"x64\Release\math.obj" /W3 /errorReport:prompt C:\Program Files (x86)\Microsoft Visual 
Studio\2019\Community\VC\Tools\MSVC\14.25.28610\bin\Hostx64\x64\ml64.exe  /Tamath.asm" exited with code 1.	KMDF Driver1	C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\
v160\BuildCustomizations\masm.targets	70	




Severity	Code	Description	Project	File	Line	Suppression State
Error	A1000	cannot open file : C:\Program	KMDF Driver1	C:\Users\jguo5\OneDrive\Documents\GitHub\myproject\MmCopyVirtual Communication\KMDF Driver1\MASM	1	


expected a declaration


my asm file:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
.code

fwrap macro a, b
sub rsp, 10h
cvtss2sd xmm0, xmm0
movsd qword ptr [rsp], xmm0
fld qword ptr [rsp]
a
b
fst qword ptr [rsp]
movsd xmm0, qword ptr [rsp]
cvtsd2ss xmm0, xmm0
add rsp, 10h
ret
endm

__sqrtf proc
fwrap fsqrt
__sqrtf endp

__sinf proc
fwrap fsin
__sinf endp

__cosf proc
fwrap fcos
__cosf endp

__tanf proc
fwrap fptan, fmulp
__tanf endp

arg1 macro
cvtss2sd xmm1, xmm1
movsd qword ptr [rsp], xmm1
fld qword ptr [rsp]
endm

__atan2f proc
fwrap arg1, fpatan
__atan2f endp

end




Any fix? thanks in advance.
Last edited on
> I did this for extern function and the cpp cannot find the asm function:
It seems to me that it can't even find the file.

> Error A1000 cannot open file
Topic archived. No new replies allowed.