Clrdump (C ++) error LNK2019: unresolved external symbol __imp__RegisterFilter @ 8 specified in _main function

I use the makefile system with the pvcs compiler (using the Microsoft Visual C ++ compiler, 2008), and I get several link errors in the form:

error LNK2019: unresolved external symbol __imp__RegisterFilter@8 referenced in function _main

This happens DESPITE using the declaration extern "C", namely:

extern "C" int CLRDUMP_API RegisterFilter( LPCWSTR pDumpFileName, unsigned long DumpType );

In addition, in makeexe.mak the library is linked as:

$ (COMPILEBASE) \ lib \ clrdump.lib \

Honestly, I am not an expert in makefiles, and I am changing the system from Microsoft Visual C ++ 6.0 to 2008. This change may have something to do with link errors, because the system used to work before.

Any help would be really appreciated.

Thanks Advance,

Regards, Joseph

- Change 1 -

Does anyone know how to include verbose in the makefile pvcs system?

, , ,

__imp__RegisterFilter@8

++

RegisterFilter

, - , .

,

- 2 -

- , , :

imp , DLL. CLRDUMP_API - __declspec(dllimport)? . .

, , , , .

, !

- 3 -

ChrisN ( ). , , , .

:

define CLRDUMP_API __declspec(dllimport) __stdcall

, __stdcall ?

- 4 -

, , ChrisN, , , . , - - , . .

+5
6

Win32 ++ VS2005, :

LNK2019: unresolved external symbol __imp__somefunction

, (prsht.h).

: โ†’ โ†’ โ†’ "C:\Program Files\Microsoft Visual Studio 8\VC\PlatformSDK\Lib".

โ†’ โ†’ โ†’ , ComCtl32.Lib ComDlg32.Lib.

- . : , . : , , , .

+3

__imp_ , , DLL.

clrdump ? , , extern "C" , . , :

dumpbin /exports clrdump.lib

RegisterFilter - ++:

?RegisterFilter@@YGHPBGK@Z (int __stdcall RegisterFilter(unsigned short const *,unsigned long))

, clrdump.lib, Visual Studio 2008. :

#include <windows.h>
#include "ClrDump.h"

int _tmain(int argc, _TCHAR* argv[])
{
    RegisterFilter(L"", 0);
    return 0;
}

:

LNK2019: unresolved external symbol "__declspec(dllimport) int __stdcall RegisterFilter(wchar_t const *,unsigned long)" (__imp_?RegisterFilter@@YGHPB_WK@Z)

Visual ++ 6.0.

, dumpbin RegisterFilter unsigned short const *, wchar_t const *. Visual ++ 6.0 wchar_t typedef unsigned short, .

Visual Studio 2008, " wchar_t as Built-in Type" "" ( /Zc:wchar_t- ), .

. , !

+14

. , , , LINK ( ). ( () MSVCRT.lib, () LIBCMT.lib) . , - . " imp _aligned_malloc". , . imp. , , , (), .

, (). . , .

+5

( , ). , , :

  • - ,
  • .

, !

+3

, , imp , x64 Win32.

+3

.DEF

If you decide to use __declspec (dllimport) with the .DEF file, you must modify the .DEF file to use DATA or CONSTANT to reduce the chance of the problem being encoded incorrectly:

// project.def
LIBRARY project
EXPORTS
   ulDataInDll   CONSTANT

The following table shows why:

Keyword      Emits in the import library   Exports
CONSTANT     _imp_ulDataInDll              _ulDataInDll
             _ulDataInDll                  

DATA         _imp_ulDataInDll              _ulDataInDll

http://msdn.microsoft.com/en-us/library/aa271769(v=vs.60).aspx

+1
source

All Articles