|
Boost Users : |
Subject: Re: [Boost-users] Adding C++/CLI code to my project makes app crash on startup
From: Sergio Basurco (sergio.b_at_[hidden])
Date: 2017-12-12 10:13:41
I have a native (unmanaged) C++ application that consumes a C# SDK using
a C++/CLI wrapper. This is achieved using a wrapper similar to the one
described here:
http://pragmateek.com/using-c-from-native-c-with-the-help-of-ccli-v2/
So the Wrapper and the SDK are managed, but my application isn't. My
application only makes calls to the C++/CLI wrapper. This is working
well and worked without issues using Visual Studio 2012 and Boost 1.57.
Sorry I don't have anything on GitHub doing exactly this. I'm checking
all my binaries but none seem to be x64. The other possible reason I
found for error 0xc000007b was linking static boost libraries. But I
deleted those just to check and still find the issue.
Thanks!
*Sergio Basurco*
Coherent Synchro
On 11/12/2017 15:16, Michael Powell via Boost-users wrote:
> On Mon, Dec 11, 2017 at 4:43 AM, Sergio Basurco via Boost-users
> <boost-users_at_[hidden]> wrote:
>> I'm building some C++/CLI code into a DLL. This DLL acts as a wrapper to C#
>> code that I use from my native C++ application.
>>
>> I double checked that the DLL is built as x86. My Boost build is also x86.
>> So I don't think it has to do with architecture. Also tried adding
>> /MACHINE:X86 to the linking parameters.
>>
>> My CLI/C++ code does not use boost at all. It is my application that uses
>> both boost code and the CLI dll.
> Explain that.
>
> You cannot do unmanaged things in a managed (CLI) application.
>
> You are probably referencing into an Any CPU or x64 project, which is
> not guaranteed to work, and/or may require additional parameters.
>
> I'm not sure how you link the Boost DLL with the target application.
>
> As I and others have stated, you can do this with your C++/CLI
> project, i.e. using Boost "inside", so to speak, but you need to be
> aware of the CLI-isms bridging into the .NET managed memory space.
>
> Show some projects on Github exactly what you're doing.
>
>> Saludos / Best regards,
>>
>> Sergio Basurco
>> Coherent Synchro
>>
>> On 06/12/2017 19:51, Steven Boswell II via Boost-users wrote:
>>
>> On Tue, Dec 5, 2017 at 10:31 PM, Sergio Basurco via Boost-users
>> <boost-users_at_[hidden]> wrote:
>>> I'm using Boost 1.65.1 with Visual Studio 2015 (v140 compiler). Also, I'm
>>> using the following libs dynamically:
>>>
>>> [...]
>>>
>>> And I want to add C++/CLI code which is built with /clr. This used to
>>> work with v110 and Boost 1.57. Now I'm getting this error just when
>>> launching the application.
>>>
>>> 0xc000007b
>>>
>>> All binaries are 32bits. I'm also using the following define:
>>> BOOST_ALL_DYN_LINK
>>>
>>> Any idea on why this may happen?
>> A Google search says that error 0xc000007b happens when you mix 64-bit and
>> 32-bit code.
>> Keep in mind that CLI code has to be explicitly compiled as 32-bit.
>> The "Any CPU" setting tends to pick the OS' native word-size, which is
>> probably 64-bit.
>>
>> -Steven
>>
>>
>>
>> _______________________________________________
>> Boost-users mailing list
>> Boost-users_at_[hidden]
>> https://lists.boost.org/mailman/listinfo.cgi/boost-users
>>
>>
>>
>> _______________________________________________
>> Boost-users mailing list
>> Boost-users_at_[hidden]
>> https://lists.boost.org/mailman/listinfo.cgi/boost-users
>>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> https://lists.boost.org/mailman/listinfo.cgi/boost-users
>
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net