User Tools

Site Tools

blog:2024-01-10_vc_clr_global_variable_and_global_array



2024-01-10 VC++/CLI: Global Variable and Global Array

  • Global variable define in VC++/CLI
  • #pragma once
    namespace TestCheckProject {
    
       using namespace System;
       using namespace System::ComponentModel;
       using namespace System::Collections;
       using namespace System::Windows::Forms;
       using namespace System::Data;
       using namespace System::Drawing;
       //
       
       /// <summary>
       /// Summary for MainForm
       /// </summary>
       public ref class MainForm : public System::Windows::Forms::Form
       {
       public:
          MainForm(void)
          {
             InitializeComponent();
             //
             //TODO: Add the constructor code here
             Global global = gcnew Global();
             //
          }
       ...
       
       private: System::Void button_CurveCalculate_Click(System::Object^ sender, System::EventArgs^ e) {
          ...
          gCalc_Arr[0] = Convert::ToInt32(((gDefCalc_Arr[4,1] - gDefCalc_Arr[3,1]) /
    			(gDefCalc_Arr[4,0] - gDefCalc_Arr[3,0])) * 1000.0);
       }
       
       int idx;
       
       // 1D Array 
       array<double, 1>^ gCalc_Arr = gcnew array<double, 1>(10);
       array<double, 1>^ gDefCalc_Arr = gcnew array<double, 1>(10);
    
       // 2D Array
       array<double, 2>^ g_Arr1 = gcnew array<double, 2>(6, 2);
       array<double, 2>^ g_Arr2 = gcnew array<double, 2>(2, 801);
    
       //int * gCalc_Arr = new int[10];
       //int * gDef_Arr = new int[10];
    
       //float * gSDFArr1 = new float[6,2];
       //float * gSDFArr2 = new float[2, 801];
       };
    }
    

TAGS

  • 37 person(s) visited this page until now.

Permalink blog/2024-01-10_vc_clr_global_variable_and_global_array.txt · Last modified: 2024/01/10 16:09 by jethro

oeffentlich