CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2010
    Posts
    53

    How can I compile some parts of C++/CLI code as Native and some part as Managed?

    Hello,

    I am calling LoadTypeLib for loading unmanaged type libraries in C++/CLI. I need to compile some code(some code areas) as managed and some code areas as unmanaged(native) code and form a mixed mode class library as executable.

    What i need to mention between the lines of code so that whatever the part i need to be compiled as managed should compiled as managed and what part I need to be unmanaged(native) should be compiled as native?


    Regards
    Usman

  2. #2
    Join Date
    Jul 2002
    Posts
    2,543

    Re: How can I compile some parts of C++/CLI code as Native and some part as Managed?

    Generally, you don't need to care. C++/CLI compiler is smart enough to detect whether code is managed and unmanaged, you can mix managed/unmanaged code by any way.
    It is possible to mark the whole function as #pragma unmanaged, but this is used only if you want, from some reasons, to generate native function, when it could be generated as managed.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured