using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace test_cuda_lib
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        [DllImport("cuda_dll_example.dll", CallingConvention = CallingConvention.Cdecl)]
        private static extern int myfunc_to_export([MarshalAs(UnmanagedType.LPArray)] int[] c, int size);

        private void button1_Click(object sender, EventArgs e)
        {
            int[] arr = new int[5];
            if (myfunc_to_export(arr, arr.Length) == 0)
            {
                textBox1.Text = "";
                foreach (int x in arr)
                    textBox1.Text += x.ToString() + " ";
            }
            else
                MessageBox.Show("Какая-то ошибка");
        }
    }
}
