Discussion:
unresolved externals porting managed wrapper from 1.1 to 2.0
(too old to reply)
Chucker
2005-10-31 14:57:04 UTC
Permalink
Hi Folks,

I am just trying to port my Application from .NET 1.1 to 2.0.

Native C++ Code works fine.
Native C# Code also works fine (just some deprecations).

The problems start when trying to port my managed C++ Wrappers.

In .NET 1.1 with a lot of reading (mostly newsgroups like this) I managed to
create managed C++ DLL`s wrapping my native libs. The key problems where
these:

(In Linker settings)

1.) Additional Dependencies: mscoree.lib msvcrt.lib (or msvcrtd.lib for
debug version) mystaticlib.lib

2.) Ignore Specific Library: nochkclr.obj

3.) Force Symbol Reference: ***@12

This works fine and I would like to port this to the new CLR.

In Visual Studio 2005 i.e. .NET 2.0 I get the following Linker errors:

1>------ Build started: Project: empDll, Configuration: Debug Win32 ------
1>Linking...
1>Parameter.obj : error LNK2028: unresolved token (0A000007) "extern "C"
void __clrcall ___CxxCallUnwindDtor(void (__clrcall*)(void *),void *)"
(?___CxxCallUnwindDtor@@$$***@Z0@Z) referenced in function "public:
virtual __thiscall std::logic_error::~logic_error(void)"
(??***@std@@$$***@XZ)
1>Imagic.obj : error LNK2028: unresolved token (0A000007) "extern "C" void
__clrcall ___CxxCallUnwindDtor(void (__clrcall*)(void *),void *)"
(?___CxxCallUnwindDtor@@$$***@Z0@Z) referenced in function "public:
__thiscall std::bad_alloc::bad_alloc(char const *)"
(??***@std@@$$***@PBD@Z)
1>Align2D.obj : error LNK2028: unresolved token (0A000008) "extern "C" void
__clrcall ___CxxCallUnwindDtor(void (__clrcall*)(void *),void *)"
(?___CxxCallUnwindDtor@@$$***@Z0@Z) referenced in function "public:
virtual __thiscall std::logic_error::~logic_error(void)"
(??***@std@@$$***@XZ)
1>Parameter.obj : error LNK2028: unresolved token (0A000347) "void __clrcall
`eh vector destructor iterator'(void *,unsigned int,int,void
(__clrcall*)(void *))" (??_M@$$***@Z@Z) referenced in function
"public: virtual void * __thiscall std::logic_error::`vector deleting
destructor'(unsigned int)" (??***@std@@$$***@Z)
1>Imagic.obj : error LNK2028: unresolved token (0A0003D3) "void __clrcall
`eh vector destructor iterator'(void *,unsigned int,int,void
(__clrcall*)(void *))" (??_M@$$***@Z@Z) referenced in function
"public: virtual void * __thiscall std::bad_alloc::`vector deleting
destructor'(unsigned int)" (??***@std@@$$***@Z)
1>Align2D.obj : error LNK2028: unresolved token (0A000358) "void __clrcall
`eh vector destructor iterator'(void *,unsigned int,int,void
(__clrcall*)(void *))" (??_M@$$***@Z@Z) referenced in function
"public: virtual void * __thiscall std::logic_error::`vector deleting
destructor'(unsigned int)" (??***@std@@$$***@Z)
1>Align2D.obj : error LNK2001: unresolved external symbol
"?.cctor@@$$FYMXXZ" (?.cctor@@$$FYMXXZ)
1>AssemblyInfo.obj : error LNK2001: unresolved external symbol
"?.cctor@@$$FYMXXZ" (?.cctor@@$$FYMXXZ)
1>Imagic.obj : error LNK2001: unresolved external symbol "?.cctor@@$$FYMXXZ"
(?.cctor@@$$FYMXXZ)
1>Parameter.obj : error LNK2001: unresolved external symbol
"?.cctor@@$$FYMXXZ" (?.cctor@@$$FYMXXZ)
1>Align2D.obj : error LNK2019: unresolved external symbol "extern "C" void
__clrcall ___CxxCallUnwindDtor(void (__clrcall*)(void *),void *)"
(?___CxxCallUnwindDtor@@$$***@Z0@Z) referenced in function "public:
virtual __thiscall std::logic_error::~logic_error(void)"
(??***@std@@$$***@XZ)
1>Imagic.obj : error LNK2001: unresolved external symbol "extern "C" void
__clrcall ___CxxCallUnwindDtor(void (__clrcall*)(void *),void *)"
(?___CxxCallUnwindDtor@@$$***@Z0@Z)
1>Parameter.obj : error LNK2001: unresolved external symbol "extern "C" void
__clrcall ___CxxCallUnwindDtor(void (__clrcall*)(void *),void *)"
(?___CxxCallUnwindDtor@@$$***@Z0@Z)
1>Align2D.obj : error LNK2019: unresolved external symbol "void __clrcall
`eh vector destructor iterator'(void *,unsigned int,int,void
(__clrcall*)(void *))" (??_M@$$***@Z@Z) referenced in function
"public: virtual void * __thiscall std::logic_error::`vector deleting
destructor'(unsigned int)" (??***@std@@$$***@Z)
1>Imagic.obj : error LNK2001: unresolved external symbol "void __clrcall `eh
vector destructor iterator'(void *,unsigned int,int,void (__clrcall*)(void
*))" (??_M@$$***@Z@Z)
1>Parameter.obj : error LNK2001: unresolved external symbol "void __clrcall
`eh vector destructor iterator'(void *,unsigned int,int,void
(__clrcall*)(void *))" (??_M@$$***@Z@Z)
1>Debug\empDll.dll : fatal error LNK1120: 9 unresolved externals
1>Build log was saved at "file://d:\Visual Studio Projects
2.0\empDll\empDll\Debug\BuildLog.htm"
1>empDll - 17 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

or

1>------ Build started: Project: empDll, Configuration: Release Win32 ------
1>Linking...
1>Parameter.obj : error LNK2028: unresolved token (0A000006) "extern "C"
void __clrcall ___CxxCallUnwindDtor(void (__clrcall*)(void *),void *)"
(?___CxxCallUnwindDtor@@$$***@Z0@Z) referenced in function "public:
virtual __thiscall std::logic_error::~logic_error(void)"
(??***@std@@$$***@XZ)
1>Imagic.obj : error LNK2028: unresolved token (0A000006) "extern "C" void
__clrcall ___CxxCallUnwindDtor(void (__clrcall*)(void *),void *)"
(?___CxxCallUnwindDtor@@$$***@Z0@Z) referenced in function "extern
"C" float __cdecl cosf(float)" (?cosf@@$$***@Z)
1>Align2D.obj : error LNK2028: unresolved token (0A000007) "extern "C" void
__clrcall ___CxxCallUnwindDtor(void (__clrcall*)(void *),void *)"
(?___CxxCallUnwindDtor@@$$***@Z0@Z) referenced in function "public:
virtual __thiscall std::logic_error::~logic_error(void)"
(??***@std@@$$***@XZ)
1>Parameter.obj : error LNK2028: unresolved token (0A0002C6) "void __clrcall
`eh vector destructor iterator'(void *,unsigned int,int,void
(__clrcall*)(void *))" (??_M@$$***@Z@Z) referenced in function
"public: virtual void * __thiscall std::logic_error::`vector deleting
destructor'(unsigned int)" (??***@std@@$$***@Z)
1>Imagic.obj : error LNK2020: unresolved token (0A00033F) "void __clrcall
`eh vector destructor iterator'(void *,unsigned int,int,void
(__clrcall*)(void *))" (??_M@$$***@Z@Z)
1>Align2D.obj : error LNK2028: unresolved token (0A0002D7) "void __clrcall
`eh vector destructor iterator'(void *,unsigned int,int,void
(__clrcall*)(void *))" (??_M@$$***@Z@Z) referenced in function
"public: virtual void * __thiscall std::logic_error::`vector deleting
destructor'(unsigned int)" (??***@std@@$$***@Z)
1>Align2D.obj : error LNK2001: unresolved external symbol
"?.cctor@@$$FYMXXZ" (?.cctor@@$$FYMXXZ)
1>AssemblyInfo.obj : error LNK2001: unresolved external symbol
"?.cctor@@$$FYMXXZ" (?.cctor@@$$FYMXXZ)
1>Imagic.obj : error LNK2001: unresolved external symbol "?.cctor@@$$FYMXXZ"
(?.cctor@@$$FYMXXZ)
1>Parameter.obj : error LNK2001: unresolved external symbol
"?.cctor@@$$FYMXXZ" (?.cctor@@$$FYMXXZ)
1>Align2D.obj : error LNK2019: unresolved external symbol "extern "C" void
__clrcall ___CxxCallUnwindDtor(void (__clrcall*)(void *),void *)"
(?___CxxCallUnwindDtor@@$$***@Z0@Z) referenced in function "public:
virtual __thiscall std::logic_error::~logic_error(void)"
(??***@std@@$$***@XZ)
1>Imagic.obj : error LNK2001: unresolved external symbol "extern "C" void
__clrcall ___CxxCallUnwindDtor(void (__clrcall*)(void *),void *)"
(?___CxxCallUnwindDtor@@$$***@Z0@Z)
1>Parameter.obj : error LNK2001: unresolved external symbol "extern "C" void
__clrcall ___CxxCallUnwindDtor(void (__clrcall*)(void *),void *)"
(?___CxxCallUnwindDtor@@$$***@Z0@Z)
1>Align2D.obj : error LNK2019: unresolved external symbol "void __clrcall
`eh vector destructor iterator'(void *,unsigned int,int,void
(__clrcall*)(void *))" (??_M@$$***@Z@Z) referenced in function
"public: virtual void * __thiscall std::logic_error::`vector deleting
destructor'(unsigned int)" (??***@std@@$$***@Z)
1>Imagic.obj : error LNK2001: unresolved external symbol "void __clrcall `eh
vector destructor iterator'(void *,unsigned int,int,void (__clrcall*)(void
*))" (??_M@$$***@Z@Z)
1>Parameter.obj : error LNK2001: unresolved external symbol "void __clrcall
`eh vector destructor iterator'(void *,unsigned int,int,void
(__clrcall*)(void *))" (??_M@$$***@Z@Z)
1>Release\empDll.dll : fatal error LNK1120: 9 unresolved externals
1>Build log was saved at "file://d:\Visual Studio Projects
2.0\empDll\empDll\Release\BuildLog.htm"
1>empDll - 17 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Could anyone please tell me how to solve these errors or where to find
newsgroups / tutorials for .NET 2.0 Interop? The usual suspects don´t know
about these issues (yet).

Thanks in advance for your efforts

Chucker
Chucker
2005-11-01 08:18:02 UTC
Permalink
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnvs05/html/TransGuide.asp
Post by Chucker
Hi Folks,
I am just trying to port my Application from .NET 1.1 to 2.0.
Native C++ Code works fine.
Native C# Code also works fine (just some deprecations).
The problems start when trying to port my managed C++ Wrappers.
In .NET 1.1 with a lot of reading (mostly newsgroups like this) I managed to
create managed C++ DLL`s wrapping my native libs. The key problems where
(In Linker settings)
1.) Additional Dependencies: mscoree.lib msvcrt.lib (or msvcrtd.lib for
debug version) mystaticlib.lib
2.) Ignore Specific Library: nochkclr.obj
This works fine and I would like to port this to the new CLR.
1>------ Build started: Project: empDll, Configuration: Debug Win32 ------
1>Linking...
1>Parameter.obj : error LNK2028: unresolved token (0A000007) "extern "C"
void __clrcall ___CxxCallUnwindDtor(void (__clrcall*)(void *),void *)"
virtual __thiscall std::logic_error::~logic_error(void)"
1>Imagic.obj : error LNK2028: unresolved token (0A000007) "extern "C" void
__clrcall ___CxxCallUnwindDtor(void (__clrcall*)(void *),void *)"
__thiscall std::bad_alloc::bad_alloc(char const *)"
1>Align2D.obj : error LNK2028: unresolved token (0A000008) "extern "C" void
__clrcall ___CxxCallUnwindDtor(void (__clrcall*)(void *),void *)"
virtual __thiscall std::logic_error::~logic_error(void)"
1>Parameter.obj : error LNK2028: unresolved token (0A000347) "void __clrcall
`eh vector destructor iterator'(void *,unsigned int,int,void
"public: virtual void * __thiscall std::logic_error::`vector deleting
1>Imagic.obj : error LNK2028: unresolved token (0A0003D3) "void __clrcall
`eh vector destructor iterator'(void *,unsigned int,int,void
"public: virtual void * __thiscall std::bad_alloc::`vector deleting
1>Align2D.obj : error LNK2028: unresolved token (0A000358) "void __clrcall
`eh vector destructor iterator'(void *,unsigned int,int,void
"public: virtual void * __thiscall std::logic_error::`vector deleting
1>Align2D.obj : error LNK2001: unresolved external symbol
1>AssemblyInfo.obj : error LNK2001: unresolved external symbol
1>Parameter.obj : error LNK2001: unresolved external symbol
1>Align2D.obj : error LNK2019: unresolved external symbol "extern "C" void
__clrcall ___CxxCallUnwindDtor(void (__clrcall*)(void *),void *)"
virtual __thiscall std::logic_error::~logic_error(void)"
1>Imagic.obj : error LNK2001: unresolved external symbol "extern "C" void
__clrcall ___CxxCallUnwindDtor(void (__clrcall*)(void *),void *)"
1>Parameter.obj : error LNK2001: unresolved external symbol "extern "C" void
__clrcall ___CxxCallUnwindDtor(void (__clrcall*)(void *),void *)"
1>Align2D.obj : error LNK2019: unresolved external symbol "void __clrcall
`eh vector destructor iterator'(void *,unsigned int,int,void
"public: virtual void * __thiscall std::logic_error::`vector deleting
1>Imagic.obj : error LNK2001: unresolved external symbol "void __clrcall `eh
vector destructor iterator'(void *,unsigned int,int,void (__clrcall*)(void
1>Parameter.obj : error LNK2001: unresolved external symbol "void __clrcall
`eh vector destructor iterator'(void *,unsigned int,int,void
1>Debug\empDll.dll : fatal error LNK1120: 9 unresolved externals
1>Build log was saved at "file://d:\Visual Studio Projects
2.0\empDll\empDll\Debug\BuildLog.htm"
1>empDll - 17 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
or
1>------ Build started: Project: empDll, Configuration: Release Win32 ------
1>Linking...
1>Parameter.obj : error LNK2028: unresolved token (0A000006) "extern "C"
void __clrcall ___CxxCallUnwindDtor(void (__clrcall*)(void *),void *)"
virtual __thiscall std::logic_error::~logic_error(void)"
1>Imagic.obj : error LNK2028: unresolved token (0A000006) "extern "C" void
__clrcall ___CxxCallUnwindDtor(void (__clrcall*)(void *),void *)"
1>Align2D.obj : error LNK2028: unresolved token (0A000007) "extern "C" void
__clrcall ___CxxCallUnwindDtor(void (__clrcall*)(void *),void *)"
virtual __thiscall std::logic_error::~logic_error(void)"
1>Parameter.obj : error LNK2028: unresolved token (0A0002C6) "void __clrcall
`eh vector destructor iterator'(void *,unsigned int,int,void
"public: virtual void * __thiscall std::logic_error::`vector deleting
1>Imagic.obj : error LNK2020: unresolved token (0A00033F) "void __clrcall
`eh vector destructor iterator'(void *,unsigned int,int,void
1>Align2D.obj : error LNK2028: unresolved token (0A0002D7) "void __clrcall
`eh vector destructor iterator'(void *,unsigned int,int,void
"public: virtual void * __thiscall std::logic_error::`vector deleting
1>Align2D.obj : error LNK2001: unresolved external symbol
1>AssemblyInfo.obj : error LNK2001: unresolved external symbol
1>Parameter.obj : error LNK2001: unresolved external symbol
1>Align2D.obj : error LNK2019: unresolved external symbol "extern "C" void
__clrcall ___CxxCallUnwindDtor(void (__clrcall*)(void *),void *)"
virtual __thiscall std::logic_error::~logic_error(void)"
1>Imagic.obj : error LNK2001: unresolved external symbol "extern "C" void
__clrcall ___CxxCallUnwindDtor(void (__clrcall*)(void *),void *)"
1>Parameter.obj : error LNK2001: unresolved external symbol "extern "C" void
__clrcall ___CxxCallUnwindDtor(void (__clrcall*)(void *),void *)"
1>Align2D.obj : error LNK2019: unresolved external symbol "void __clrcall
`eh vector destructor iterator'(void *,unsigned int,int,void
"public: virtual void * __thiscall std::logic_error::`vector deleting
1>Imagic.obj : error LNK2001: unresolved external symbol "void __clrcall `eh
vector destructor iterator'(void *,unsigned int,int,void (__clrcall*)(void
1>Parameter.obj : error LNK2001: unresolved external symbol "void __clrcall
`eh vector destructor iterator'(void *,unsigned int,int,void
1>Release\empDll.dll : fatal error LNK1120: 9 unresolved externals
1>Build log was saved at "file://d:\Visual Studio Projects
2.0\empDll\empDll\Release\BuildLog.htm"
1>empDll - 17 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Could anyone please tell me how to solve these errors or where to find
newsgroups / tutorials for .NET 2.0 Interop? The usual suspects don´t know
about these issues (yet).
Thanks in advance for your efforts
Chucker
Chucker
2005-11-01 08:19:03 UTC
Permalink
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnvs05/html/TransGuide.asp
s***@btopenworld.com
2005-11-05 14:43:01 UTC
Permalink
Remove the /Zl option. Project Settings / C/C++ / Command line options .
Tanakom Talawat
2009-06-12 10:38:40 UTC
Permalink
Thank you stephen, it works

Cheers,
Tanakom

From http://www.developmentnow.com/g/21_2005_10_0_0_627869/unresolved-externals-porting-managed-wrapper-from-1-1-to-2-0.ht

Posted via DevelopmentNow.com Group
http://www.developmentnow.com/g/
Dave J
2010-06-02 16:15:26 UTC
Permalink
I found that you first had to change `treate wchar_t as Built-in Type` to `No` (Project Settings / C/C++ / Language), click apply, then go to Project Settings / C/C++ / Command Line and remove the /ZI option

From http://www.developmentnow.com/g/21_2009_6_0_0_627869/unresolved-externals-porting-managed-wrapper-from-1-1-to-2-0.htm

Posted via DevelopmentNow.com Groups
http://www.developmentnow.com/g/

Loading...