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

Managed C++/CLI

 
GeneralRe: Marshal a struct to unmanaged memory Pin
led mike16-Jan-08 10:27
led mike16-Jan-08 10:27 
AnswerRe: Marshal a struct to unmanaged memory Pin
George L. Jackson17-Jan-08 9:50
George L. Jackson17-Jan-08 9:50 
GeneralRe: Marshal a struct to unmanaged memory Pin
Member 412487318-Jan-08 2:45
Member 412487318-Jan-08 2:45 
GeneralCall ATL Com dll function in Managed C++ Pin
Rahul.RK16-Jan-08 0:30
Rahul.RK16-Jan-08 0:30 
GeneralRe: Call ATL Com dll function in Managed C++ Pin
led mike16-Jan-08 5:37
led mike16-Jan-08 5:37 
GeneralRe: Call ATL Com dll function in Managed C++ Pin
Mark Salsbery16-Jan-08 7:24
Mark Salsbery16-Jan-08 7:24 
GeneralRe: Call ATL Com dll function in Managed C++ Pin
led mike16-Jan-08 7:55
led mike16-Jan-08 7:55 
QuestionProblem with InternalsVisibleToAttribute and inter-assembly class members access Pin
Abix15-Jan-08 4:25
Abix15-Jan-08 4:25 
Hello!

I'm have a public managed class in assembly1 with one internal static field field1. This assembly has attribute

[assembly: System::Runtime::CompilerServices::InternalsVisibleToAttribute("assemly2")].


But when I try to access these internal field1 from assembly2 I get an compiler error:

2> c:\projects\assembly1\assembly2\Assembly2.h(14) : error C2248: 'Assembly1::Class1::Field1' : cannot access private member declared in class 'Assembly1::Class1'
2> c:\projects\assembly1\assembly2\Assembly2.h(14) : see declaration of 'Assembly1::Class1::Field1'
2> c:\projects\assembly1\debug\assembly1.dll : see declaration of 'Assembly1::Class1'

VC++ 2008 used.

When I created the same project in VC# 2008 (assembly2) it compiles perfectly and see the internal field1 without any problems.



Source code:



<code>
#pragma once

using namespace System;
namespace Assembly1 {

public ref class Class1
{
internal:
static int Field1;
};

[assembly: System::Runtime::CompilerServices::InternalsVisibleToAttribute("Assembly2")];

}


===========================================================================


// Assembly2.h

#pragma once

using namespace System;
using namespace Assembly1;
namespace Assembly2 {

public ref class Class1

{
void TestC2248()
{
Assembly1::Class1::Field1 = 0; // C2248
}
};
}
</code>


What I'm doing wrong?

Thanks.
GeneralRe: Problem with InternalsVisibleToAttribute and inter-assembly class members access Pin
led mike15-Jan-08 4:37
led mike15-Jan-08 4:37 
GeneralRe: Problem with InternalsVisibleToAttribute and inter-assembly class members access [modified] Pin
Abix15-Jan-08 5:01
Abix15-Jan-08 5:01 
GeneralVisual c++ Net application Deployment Pin
mikobi14-Jan-08 19:32
mikobi14-Jan-08 19:32 
GeneralRe: Visual c++ Net application Deployment Pin
led mike15-Jan-08 4:40
led mike15-Jan-08 4:40 
GeneralTo Load Image Pin
mikobi14-Jan-08 4:22
mikobi14-Jan-08 4:22 
GeneralRe: To Load Image Pin
Paul Conrad25-Jan-08 16:01
professionalPaul Conrad25-Jan-08 16:01 
GeneralRe: To Load Image Pin
mikobi25-Jan-08 19:27
mikobi25-Jan-08 19:27 
GeneralSplitContainer Pin
mikobi14-Jan-08 0:05
mikobi14-Jan-08 0:05 
GeneralNavigation pane menu Pin
mikobi10-Jan-08 0:34
mikobi10-Jan-08 0:34 
GeneralFinding the menu item the mouse is over for help request [modified] Pin
earlgraham4-Jan-08 6:59
earlgraham4-Jan-08 6:59 
GeneralRe: Finding the menu item the mouse is over for help request Pin
Luc Pattyn4-Jan-08 7:41
sitebuilderLuc Pattyn4-Jan-08 7:41 
GeneralRe: Finding the menu item the mouse is over for help request Pin
earlgraham4-Jan-08 8:00
earlgraham4-Jan-08 8:00 
GeneralRe: Finding the menu item the mouse is over for help request Pin
Luc Pattyn4-Jan-08 8:45
sitebuilderLuc Pattyn4-Jan-08 8:45 
Questionpassing a path (ie. c:\thisfolder\thisfile.txt) to ShellExecute... Pin
peepsicola2-Jan-08 6:10
peepsicola2-Jan-08 6:10 
GeneralRe: passing a path (ie. c:\thisfolder\thisfile.txt) to ShellExecute... Pin
Paul Conrad2-Jan-08 6:23
professionalPaul Conrad2-Jan-08 6:23 
GeneralRe: passing a path (ie. c:\thisfolder\thisfile.txt) to ShellExecute... Pin
Mark Salsbery2-Jan-08 7:49
Mark Salsbery2-Jan-08 7:49 
GeneralCANNOT add new database in C++ 2008 (bug BY DESIGN!) Pin
Palavos1-Jan-08 22:07
Palavos1-Jan-08 22:07 

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.