Click here to Skip to main content
15,886,519 members
Home / Discussions / Managed C++/CLI
   

Managed C++/CLI

 
GeneralRe: How to stop a simulation while running Pin
KlaasVersteeg23-Jun-10 2:42
KlaasVersteeg23-Jun-10 2:42 
AnswerRe: How to stop a simulation while running Pin
Luc Pattyn23-Jun-10 3:14
sitebuilderLuc Pattyn23-Jun-10 3:14 
GeneralRe: How to stop a simulation while running [modified] Pin
KlaasVersteeg23-Jun-10 21:08
KlaasVersteeg23-Jun-10 21:08 
GeneralRe: How to stop a simulation while running Pin
Luc Pattyn24-Jun-10 2:48
sitebuilderLuc Pattyn24-Jun-10 2:48 
GeneralRe: How to stop a simulation while running Pin
KlaasVersteeg24-Jun-10 3:04
KlaasVersteeg24-Jun-10 3:04 
GeneralRe: How to stop a simulation while running Pin
Luc Pattyn24-Jun-10 3:38
sitebuilderLuc Pattyn24-Jun-10 3:38 
GeneralRe: How to stop a simulation while running Pin
KlaasVersteeg24-Jun-10 3:49
KlaasVersteeg24-Jun-10 3:49 
Questionproblem with BOOST threads with mixed mode C++/CLI and Visual Studio 2010 [modified] Pin
T210221-Jun-10 18:38
T210221-Jun-10 18:38 
I add reference to BOOST thread header and do not even use it yet. Then when I run my application I immediately get the error message
"The application failed to initialize properly. Click on OK to terminate the application."

I found a possible solution while googling, but am not sure if it is safe. Their is a run-time error at startup depending on the #pragma managed and #pragma unmanaged usage.

"Alas, the default compiler settings may lead to trouble:
Statically linking to Boost libraries may yield an executable
which chokes on startup with a System.BadImageFormatException, even
if the compiler and linker run without warning (a bug, IMHO).

Explanantion:

<cite author="Anthony Williams" date="2009-02-04 15:54:40 GMT">
The problem is that the static boost thread library tries to hook the
native win32 PE TLS callbacks in order to ensure that the thread-local
data used by boost thread is cleaned up correctly. This is not
compatible with a C++/CLI executable.
</cite>

Solution: In Configuration Properties -> C/C++ -> Preprocessor ->
Preprocessor Definitions add BOOST_ALL_DYN_LINK in order to
force the usage of the DLLs.
In addition copy the necessary DLLs to the directory where the
executable resides. E.g. copy boost_thread-vc90-mt-gd-1_XX.dll
to MyApp/bin/Debug.

Enters the next bug of Visual Studio:

The C++/CLI compiler deliberately chooses to ignore the
#pragma managed(push, off) / #pragma managed(pop) PREPRO directives
for files which are compiled with /clr command line flag.

You obtain a plethora of warnings of the form
warning C4793: 'boost::[..]::`vcall'{0}'' : function compiled as native :

For the executable this means that on termination another exception
is thrown, which adds to the confusion:

Unhandled exception at 0x7c812a7b in XXX.exe: 0xC0020001:
"Die Zeichenfolgenbindung ist unzulässig." or in english:
Error 1700 "The string binding is invalid" or
RPC_S_INVALID_STRING_BINDING.

Solution: Put managed (CLI) and unmanaged C++ code into different
compilation units. For unmanaged code files change the compiler
settings this way:

In "Configuration Properties -> C/C++ -> General -> Compiler with
Common Language" support choose "No Common Language Support".
"

modified on Tuesday, June 22, 2010 9:06 AM

AnswerRe: problem with BOOST threads with mixed mode C++/CLI and Visual Studio 2010 Pin
Paul Michalik20-Aug-10 23:14
Paul Michalik20-Aug-10 23:14 
GeneralRe: problem with BOOST threads with mixed mode C++/CLI and Visual Studio 2010 Pin
T210220-Aug-10 23:22
T210220-Aug-10 23:22 
GeneralRe: problem with BOOST threads with mixed mode C++/CLI and Visual Studio 2010 [modified] Pin
Paul Michalik21-Aug-10 23:40
Paul Michalik21-Aug-10 23:40 
GeneralRe: problem with BOOST threads with mixed mode C++/CLI and Visual Studio 2010 Pin
T210222-Aug-10 1:27
T210222-Aug-10 1:27 
GeneralRe: problem with BOOST threads with mixed mode C++/CLI and Visual Studio 2010 Pin
Paul Michalik22-Aug-10 21:46
Paul Michalik22-Aug-10 21:46 
GeneralRe: problem with BOOST threads with mixed mode C++/CLI and Visual Studio 2010 Pin
T210223-Aug-10 3:38
T210223-Aug-10 3:38 
QuestionUnraveling the Mysteries of Writing a Winsock 2 Layered Service Provider Pin
Pascal Ganaye21-Jun-10 12:16
Pascal Ganaye21-Jun-10 12:16 
AnswerRe: Unraveling the Mysteries of Writing a Winsock 2 Layered Service Provider Pin
Pascal Ganaye22-Jun-10 14:26
Pascal Ganaye22-Jun-10 14:26 
GeneralRe: Unraveling the Mysteries of Writing a Winsock 2 Layered Service Provider Pin
Richard Andrew x6422-Jun-10 14:32
professionalRichard Andrew x6422-Jun-10 14:32 
QuestionAssembly info not showing up in explorer in managed DLL Pin
alleyes16-Jun-10 9:01
professionalalleyes16-Jun-10 9:01 
AnswerRe: Assembly info not showing up in explorer in managed DLL Pin
Nish Nishant19-Jun-10 7:25
sitebuilderNish Nishant19-Jun-10 7:25 
GeneralRe: Assembly info not showing up in explorer in managed DLL Pin
alleyes20-Jun-10 5:53
professionalalleyes20-Jun-10 5:53 
GeneralRe: Assembly info not showing up in explorer in managed DLL Pin
Nish Nishant20-Jun-10 5:54
sitebuilderNish Nishant20-Jun-10 5:54 
QuestionHow can I compile some parts of C++/CLI code as Native and some part as Managed? Pin
glitteringsound7-Jun-10 21:53
glitteringsound7-Jun-10 21:53 
AnswerRe: How can I compile some parts of C++/CLI code as Native and some part as Managed? Pin
Nish Nishant12-Jun-10 6:42
sitebuilderNish Nishant12-Jun-10 6:42 
QuestionExchange Autodiscover Service Pin
Steve Thresher7-Jun-10 6:41
Steve Thresher7-Jun-10 6:41 
QuestionWhy (LoadTypeLibEx failed : : Error loading type library/DLL. (Exception from HRESULT: 0x80029C4A (TYPE_E_CANTLOADLIBRARY))? [modified] Pin
glitteringsound7-Jun-10 6:30
glitteringsound7-Jun-10 6:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.