c++ - Linkage problem
- MRatcliff (17/17) Nov 13 2010 I used implib to create a .lib file for psapi.dll. I also found a header...
- Walter Bright (3/25) Nov 26 2010 The @12 means it is compiled using the stdcall calling convention, not t...
- MRatcliff (5/5) Nov 26 2010 Thanks -
I used implib to create a .lib file for psapi.dll. I also found a header file. The header file contains an ifdef __cplusplus declaration so it appears the linkage should have C semantics. The .lib file shows, among other entry points, the following (using libunres): _EnumProcessModules _EnumProcessModulesEx _EnumProcesses _GetDeviceDriverBaseNameA _GetDeviceDriverBaseNameW The 'EnumProcesses' is the function I am calling in a test application. When it links I get the following error: OPTLINK (R) for Win32 Release 8.00.5 Copyright (C) Digital Mars 1989-2009 All rights reserved. http://www.digitalmars.com/ctg/optlink.html .\Obj\tproclist.obj(tproclist) Error 42: Symbol Undefined _EnumProcesses 12 How can I get this to resolve corrrectly?
Nov 13 2010
MRatcliff wrote:I used implib to create a .lib file for psapi.dll. I also found a header file. The header file contains an ifdef __cplusplus declaration so it appears the linkage should have C semantics. The .lib file shows, among other entry points, the following (using libunres): _EnumProcessModules _EnumProcessModulesEx _EnumProcesses _GetDeviceDriverBaseNameA _GetDeviceDriverBaseNameW The 'EnumProcesses' is the function I am calling in a test application. When it links I get the following error: OPTLINK (R) for Win32 Release 8.00.5 Copyright (C) Digital Mars 1989-2009 All rights reserved. http://www.digitalmars.com/ctg/optlink.html .\Obj\tproclist.obj(tproclist) Error 42: Symbol Undefined _EnumProcesses 12 How can I get this to resolve corrrectly?The 12 means it is compiled using the stdcall calling convention, not the C++ calling convention.
Nov 26 2010
Thanks - Problem resolved by removing the WINAPI macro from the header file. BOOL WINAPI EnumProcesses(DWORD *,DWORD,DWORD *); To BOOL EnumProcesses(DWORD *,DWORD,DWORD *);
Nov 26 2010