Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6714503
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:30:13+00:00 2026-05-26T08:30:13+00:00

I am working with C++/CLI for C Library. I explored in the net about

  • 0

I am working with C++/CLI for C Library. I explored in the net about it. I got several links about it.

Mixed mode C++/CLI performance considerations – best practices

I am developing a C++/CLI DLL which will wrap a C static library.

There was one suggestion that I really wanted to discuss here is “One should not mix up managed and unmanaged C++ code in wrapper”. I don’t understand meaning of it.

The managed DLL will, of course, contain managed C++ code and unmanaged C++ code.

The purpose of the wrapper is to translate calls from the static library to managed code DLL.

Please clear my doubts – I wanted comments on this.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T08:30:13+00:00Added an answer on May 26, 2026 at 8:30 am

    If you have a regular C++ library (non-CLI), you should avoid turning on the ‘CLI’ compilation option for that library, for performance reasons.

    Instead it is good practice to create a library that just has your wrapper classes in it. This library will of course be C++/CLI, and will create an assembly that can be referenced by regular .Net libraries.

    So that’s probably what the advice would be talking about – create a wrapper library for your CLI wrappers

    — addendum for the updated question

    A managed C++/CLI class should not contain unmanaged code because it /cannot/ contain many types of unmanaged code.

    For example, a C++/CLI class cannot have any unmanaged member variables that are not references or pointers. This is because the .Net runtime garbage collector may decide to put the object somewhere else in memory at any time (this is the reason you need to pin memory etc.). If the GC decides to move your native C++ objects to some other place in memory, this will potentially invalidate any pointers you have to that object. This is obviously bad.

    C++/CLI is a great language. If you use it, however, you should either decide to write pure .Net code, or you should use it as an interface between native C++ and .Net. Having mixed memory models in the same class just confuses things.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working with mixed mode assemblies in C++/CLI. All managed mode assembled pdb's
I'm working on a project where a c++/cli library is being used primarily from
I'm new to C++/CLI, so please bear with me... I'm working on a mixed
I just got PHP-CLI working on my Windows machine so I could create scripts
I'm working on a mixed managed/native application using c++/CLI. I know that the CLR
I am working on C++/CLI Wrapper for C Static Library.Static Library has 10 function
I'm working on a CLI application that deals with uploading of files, and would
I'm working on a project where a mixture of C# (95%) and C++/CLI (5%)
I've been trying to get started with unit-testing while working on a little cli
I'm currently working on a CLI app in Ruby, I'm using Trollop ( http://trollop.rubyforge.org/

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.