Quantcast
Channel: Questions in topic: "dll"
Viewing all articles
Browse latest Browse all 706

Unity crushes while running dll functions(log+code)

$
0
0
http://rghost.ru/79NkzRx7p - here is log file using UnityEngine; using System.Collections; using System; using System.Runtime.InteropServices; public class Grapher2 : MonoBehaviour { [DllImport ("1" )] private static extern void Create_polygon( int aa,int log_, int N_x, int N_y, double N_t); [DllImport ("1" )] private static extern void Get_partition (); [DllImport ("1" )] private static extern double Get_length(); [DllImport ("1" )] private static extern double Get_height (); [DllImport ("1" )] private static extern int Get_x (); [DllImport ("1" )] private static extern int Get_y (); [DllImport ("1" )] private unsafe static extern void Solve(double time_start,int NT,double * Temp); [DllImport ("1" )] private static extern double Get_Temp_By_ij( int i, int j); [DllImport ("1" )] private static extern double Get_Temp_By_xy( double x, double y); //some more code here// void Update () { if (currentResolutionx != resolutionx ||currentResolutiony != resolutiony || points == null) { CreatePoints(); } if (Input.GetButton("Fire1")) { Vector2 mouse = Camera.main.ScreenToWorldPoint(Input.mousePosition); if(mouse.x<=Graph.x+1 && mouse.x>=Graph.x && mouse.y>=Graph.y && mouse.y<=Graph.y+1) { scannedpoint = mouse; Point.transform.position = scannedpoint; Graph2.GetComponent().scannedpoint = scannedpoint; SPP.GetComponent().x = ((scannedpoint.x)*xk).ToString(); SPP.GetComponent().y = ((scannedpoint.y)*yk).ToString(); } } if (ExperiementOn) { unsafe { fixed(double* qwe = &(TT[0])){ Debug.Log("Fu 3"); time_start += SMALL_TIME_STEP * Time_steps; Solve (time_start,Time_steps,qwe); Debug.Log("DD 4"); Debug.Log("DD 5"); CLOCK.GetComponent ().delta = SMALL_TIME_STEP * Time_steps; for (int i = 0; i < points.Length; i++) { float Temp = (float)((double)(*(qwe+i*8))); if (Temp > 0) points [i].color = RGBfromTemp (Temp); points [i].color = new Color(1f,1f,0f); points [i].size = size; } } } particleSystem.SetParticles (points, points.Length); } } I use unity3d in order to make a visualization for a computer experiement, which is written in C++. So i wrapped it into dll file and tried it. Some functions worked fine, some did not. The probable issue might be the following: i allocate memory for an array of doubles in c# code, then pass the pointer to c++ dll function and then try to read from it. Can't see anything wrong with it, but if i erase the part of the code responsible for that, it does not crash.

Viewing all articles
Browse latest Browse all 706

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>