Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. // MyClassLib.h
  2. #pragma once
  3. #include "MyLegacyStruct.h"
  4. using namespace System;
  5.  
  6. namespace MyClassLib {
  7.  
  8. public ref class Class1
  9. {
  10. protected:
  11. MyLegacyStruct* m_internalBuffer;
  12.  
  13. public:
  14. Class1() { }
  15. ~Class1() { }
  16.  
  17. MyLegacyStruct* GetBuffer()
  18. {
  19. return m_internalBuffer;
  20. }
  21. };
  22. }
  23.  
  24. // MyLegacyStruct.h
  25. #pragma once
  26.  
  27. namespace MyClassLib {
  28.  
  29. typedef struct MyLegacyStruct
  30. {
  31. unsigned int m_someVar;
  32.  
  33. } MyLegacyStruct;
  34.  
  35. }
  36.  
  37. // ConsoleApp.cpp : main project file.
  38.  
  39. #include "stdafx.h"
  40. #include "MyLegacyStruct.h"
  41.  
  42. using namespace System;
  43. using namespace MyClassLib;
  44.  
  45. int main(array<System::String ^> ^args)
  46. {
  47. Console::WriteLine(L"Hello World");
  48.  
  49. Class1^ c1 = gcnew Class1();
  50. MyLegacyStruct* s1 = c1->GetBuffer(); // <-- This is a problem
  51.  
  52. return 0;
  53. }
  54.  
  55. 2>.ConsoleApp.cpp(14) : error C3767: 'MyClassLib::Class1::GetBuffer': candidate function(s) not accessible
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement