CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: [RESOLVED] /clr

  1. #1
    Join Date
    Jul 2010
    Posts
    18

    [RESOLVED] /clr

    This may be obvious, but ill ask it anyways.

    I have a native dll which I am converting to a managed one using the /CLR compiler switch in visual studio. It has a number of static (which I had previously converted from dynamic) libraries it draws from.

    these libraries have some files being compiled as C code, rather than C++. Is it required to convert these libraries to /CLR and the C files to C++? I would assume if it was a clean native C++ transition it would be fine, I assume I dont really even need /CLR for the libraries. But I am new to interop.

    Thank You.

  2. #2
    Join Date
    Jul 2010
    Posts
    18

    Re: /clr

    found the answer to this question, which seems like it should have been obvious now. Anyways someone might wonder this in the future. If you have project with mixed native code and managed code, files with managed code should be compile with /clr individually while files with native without /clr. if you have managed code in a file but want some parts compiled as native, use

    Code:
    #pragma managed(push, off)
    // Native Code
    #pragma managed(pop)
    
    //or
    
    #pragma unmanaged
    // Native Code
    #pragma managed
    
    // Not sure if there is a difference

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