[wdmaudiodev] Re: AERT_XXX calls linker error for 32-bit build (ok for 64-bit)

  • From: "Matthew van Eerde" <dmarc-noreply@xxxxxxxxxxxxx> (Redacted sender "Matthew.van.Eerde" for DMARC)
  • To: "wdmaudiodev@xxxxxxxxxxxxx" <wdmaudiodev@xxxxxxxxxxxxx>
  • Date: Wed, 7 Nov 2018 19:50:24 +0000

(summarizing offline conversation for those following along)

Yup, calling convention issue. baseaudioprocessingobject.h declares 
AERT_Allocate and AERT_Free as __cdecl, but audioeng.lib exports __stdcall. So 
the linker is looking for _AERT_Free but what actually exists is _AERT_Free@4

Filed a bug internally, thanks for the heads-up.

https://docs.microsoft.com/en-us/cpp/build/reference/decorated-names?view=vs-2017
__cdecl: Leading underscore (_)
__stdcall: Leading underscore (_) and a trailing at sign (@) followed by the 
number of bytes in the parameter list in decimal

________________________________
From: wdmaudiodev-bounce@xxxxxxxxxxxxx <wdmaudiodev-bounce@xxxxxxxxxxxxx> on 
behalf of Matthew van Eerde <dmarc-noreply@xxxxxxxxxxxxx>
Sent: Wednesday, November 7, 2018 8:26:38 AM
To: wdmaudiodev@xxxxxxxxxxxxx
Subject: [wdmaudiodev] Re: AERT_XXX calls linker error for 32-bit build (ok for 
64-bit)

Works on 64-bit, but not on 32-bit… smells like a calling convention mismatch. 
What is the default calling convention for your product?

https://msdn.microsoft.com/en-us/library/46t77ak2.aspx<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fmsdn.microsoft.com%2Fen-us%2Flibrary%2F46t77ak2.aspx&data=02%7C01%7Cmatthew.van.eerde%40microsoft.com%7C4a0a644a5b87447254d808d644cddfac%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636772048452600304&sdata=y1O05YQICMo9mRa1Jo1R6%2B%2BXN0Aj8Kcvan4aZ0ezAcU%3D&reserved=0>
/Gd __cdecl
/Gr __fastcall
/Gv __vectorcall
/Gz __stdcall

I see that baseaudioprocessingobject.h declares AERT_Allocate inside an extern 
“C” { … } block, and audioeng.dll exports AERT_Allocate (without any leading 
underscores.)

Can you share the full error message?

________________________________
From: wdmaudiodev-bounce@xxxxxxxxxxxxx <wdmaudiodev-bounce@xxxxxxxxxxxxx> on 
behalf of Culann mac Cabe <culann@xxxxxxxxxx>
Sent: Wednesday, November 7, 2018 3:37:54 AM
To: wdmaudiodev@xxxxxxxxxxxxx
Subject: [wdmaudiodev] AERT_XXX calls linker error for 32-bit build (ok for 
64-bit)

Hello wdmaudiodev people.

I am using Visual Studio 2017 to develop a Windows APO driver and I am seeing a 
Linker Error (unresolved external symbol 'symbol' referenced in function 
'function<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fcpp%2Ferror-messages%2Ftool-errors%2Flinker-tools-error-lnk2019%3Ff1url%3Dhttps%253A%252F%252Fmsdn.microsoft.com%252Fquery%252Fdev15.query%253FappId%253DDev15IDEF1%2526l%253DEN-US%2526k%253Dk(LNK2019)%2526rd%253Dtrue%26view%3Dvs-2017&data=02%7C01%7Cmatthew.van.eerde%40microsoft.com%7C4a0a644a5b87447254d808d644cddfac%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636772048452600304&sdata=EXuTShg16hVr%2B45%2FXDAVWBbjEugaquvnLK0R3Kh6TI8%3D&reserved=0>')
 associated with a call to the memory allocation function 
AERT_Allocate()<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fwindows%2Fdesktop%2Fapi%2Fbaseaudioprocessingobject%2Fnf-baseaudioprocessingobject-aert_allocate%23requirements&data=02%7C01%7Cmatthew.van.eerde%40microsoft.com%7C4a0a644a5b87447254d808d644cddfac%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636772048452610313&sdata=Nlakc9%2F9eiUNgYHmZdSKIspDjbplAsaWWFiCcHAltYs%3D&reserved=0>
 which MS recommends/requires for real time functions...

AERT_Allocate links Audioeng.lib and, simply put, my project links succesfully 
against the 64 bit lib but I get the above Linker error when attempting to link 
against the 32 bit library.  My verbose linker output shows my paths etc to be 
correct, so the issue appears to be related to 64 bit vs 32.

Is this a Visual Studio issue/bug or can anyone provide any 
suggestions/recommendations?

Thanks!
Culann

Other related posts: