Re: Calling native C++ dll code from managed C++
From: Paul Brun (pb_newsgroup_at_pbrun.net)
Date: 03/05/04
- Next message: corey2004: "StackOverflowException"
- Previous message: Hendrik Schober: "Re: Exceptions"
- In reply to: Sam Gentile [MVP - C#/.NET]: "Re: Calling native C++ dll code from managed C++"
- Next in thread: Sam Gentile [MVP - C#/.NET]: "Re: Calling native C++ dll code from managed C++"
- Reply: Sam Gentile [MVP - C#/.NET]: "Re: Calling native C++ dll code from managed C++"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 5 Mar 2004 10:51:12 -0500
I have read your articles, but it seem to have a problem using the following
steps to build me Managed C++ Wrapper for a C library.
- Link with /NOENTRY. In Solution Explorer, right-click the project node and
click Properties. In the project's Property Pages dialog box, click Linker,
and then click Command Line. Add this switch to the Additional Options
field.
- Link msvcrt.lib. In the project's Property Pages dialog box, click Linker,
and then click Input. Add msvcrt.lib to the Additional Dependencies
property.
- Remove nochkclr.obj. On the Input page (same page as previous step),
remove nochkclr.obj from the Additional Dependencies property.
- Link in the CRT. On the Input page (same page as previous step), add
__DllMainCRTStartup@12 to the Force Symbol References property.
These steps are highlighted on the Microsoft website, however, in order for
my library to
compile and link properly, I have to skip step 2. If I don't, I get the
following errors:
libcmt.lib(crt0init.obj) : error LNK2005: ___xc_z already defined in
msvcrt.lib(cinitexe.obj)
libcmt.lib(crt0init.obj) : error LNK2005: ___xc_a already defined in
msvcrt.lib(cinitexe.obj)
libcmt.lib(crt0init.obj) : error LNK2005: ___xi_z already defined in
msvcrt.lib(cinitexe.obj)
libcmt.lib(crt0init.obj) : error LNK2005: ___xi_a already defined in
msvcrt.lib(cinitexe.obj)
libcmt.lib(winxfltr.obj) : error LNK2005: ___CppXcptFilter already defined
in msvcrt.lib(MSVCR71.dll)
libcmt.lib(crt0.obj) : error LNK2005: __amsg_exit already defined in
msvcrt.lib(MSVCR71.dll)
libcmt.lib(crt0.obj) : error LNK2019: unresolved external symbol _main
referenced in function _mainCRTStartup
D:\Mitel-Development\MiTAI.NET\MitaiNet\Debug\MitaiNet.dll : fatal error
LNK1120: 1 unresolved externals
However, if I were to leave my .NET Class Library settings like they were
when ti was created, I get the linker error that references the "_main"
symbol being unresolved.
Now, my application is not running correctly because of an exception within
the "strtok" function as outline in another post that nobody has been able
to help me with...
Thanks
Paul
- Next message: corey2004: "StackOverflowException"
- Previous message: Hendrik Schober: "Re: Exceptions"
- In reply to: Sam Gentile [MVP - C#/.NET]: "Re: Calling native C++ dll code from managed C++"
- Next in thread: Sam Gentile [MVP - C#/.NET]: "Re: Calling native C++ dll code from managed C++"
- Reply: Sam Gentile [MVP - C#/.NET]: "Re: Calling native C++ dll code from managed C++"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|