Skip to content

Commit 701f292

Browse files
Merge pull request #1787 from Holo-Krzysztof/master
Changed SpatialUnderstanding DllImports to cdecl.
2 parents 9fb253b + 88cc736 commit 701f292

File tree

4 files changed

+25
-25
lines changed

4 files changed

+25
-25
lines changed

Assets/HoloToolkit/SpatialUnderstanding/Scripts/SpatialUnderstandingDll.cs

+10-10
Original file line numberDiff line numberDiff line change
@@ -362,12 +362,12 @@ public enum SurfaceTypes
362362
/// before any other DLL function.
363363
/// </summary>
364364
/// <returns>Zero if fails, one if success</returns>
365-
[DllImport("SpatialUnderstanding")]
365+
[DllImport("SpatialUnderstanding", CallingConvention = CallingConvention.Cdecl)]
366366
public static extern int SpatialUnderstanding_Init();
367367
/// <summary>
368368
/// Terminate the spatial understanding DLL.
369369
/// </summary>
370-
[DllImport("SpatialUnderstanding")]
370+
[DllImport("SpatialUnderstanding", CallingConvention = CallingConvention.Cdecl)]
371371
public static extern void SpatialUnderstanding_Term();
372372

373373
/// <summary>
@@ -384,7 +384,7 @@ public enum SurfaceTypes
384384
/// <param name="camUp_Z">The user's camera/view unit up vector, z value</param>
385385
/// <param name="searchDst">Suggested search distance for playspace center</param>
386386
/// <param name="optimalSize">Optimal room size. Used to determined the playspace size</param>
387-
[DllImport("SpatialUnderstanding")]
387+
[DllImport("SpatialUnderstanding", CallingConvention = CallingConvention.Cdecl)]
388388
public static extern void GeneratePlayspace_InitScan(
389389
[In] float camPos_X, [In] float camPos_Y, [In] float camPos_Z,
390390
[In] float camFwd_X, [In] float camFwd_Y, [In] float camFwd_Z,
@@ -407,7 +407,7 @@ public static extern void GeneratePlayspace_InitScan(
407407
/// <param name="camUp_Z">The user's camera/view unit up vector, z value</param>
408408
/// <param name="deltaTime">Time since last update</param>
409409
/// <returns>One if scanning has been finalized, zero if more updates are required.</returns>
410-
[DllImport("SpatialUnderstanding")]
410+
[DllImport("SpatialUnderstanding", CallingConvention = CallingConvention.Cdecl)]
411411
public static extern int GeneratePlayspace_UpdateScan(
412412
[In] int meshCount, [In] IntPtr meshes,
413413
[In] float camPos_X, [In] float camPos_Y, [In] float camPos_Z,
@@ -420,7 +420,7 @@ public static extern int GeneratePlayspace_UpdateScan(
420420
/// finalized. This should be called once the user is happy with the currently
421421
/// scanned in playspace.
422422
/// </summary>
423-
[DllImport("SpatialUnderstanding")]
423+
[DllImport("SpatialUnderstanding", CallingConvention = CallingConvention.Cdecl)]
424424
public static extern void GeneratePlayspace_RequestFinish();
425425

426426
/// <summary>
@@ -432,7 +432,7 @@ public static extern int GeneratePlayspace_UpdateScan(
432432
/// <param name="vertexCount">Filled in with the number of vertices to be returned in the subsequent extract call</param>
433433
/// <param name="indexCount">Filled in with the number of indices to be returned in the subsequent extract call</param>
434434
/// <returns>Zero if fails, one if success</returns>
435-
[DllImport("SpatialUnderstanding")]
435+
[DllImport("SpatialUnderstanding", CallingConvention = CallingConvention.Cdecl)]
436436
public static extern int GeneratePlayspace_ExtractMesh_Setup(
437437
[Out] out int vertexCount,
438438
[Out] out int indexCount);
@@ -447,7 +447,7 @@ public static extern int GeneratePlayspace_ExtractMesh_Setup(
447447
/// <param name="bufferIndexCount">Size of indices, in number of elements</param>
448448
/// <param name="indices">Array to receive the mesh indices</param>
449449
/// <returns>Zero if fails, one if success</returns>
450-
[DllImport("SpatialUnderstanding")]
450+
[DllImport("SpatialUnderstanding", CallingConvention = CallingConvention.Cdecl)]
451451
public static extern int GeneratePlayspace_ExtractMesh_Extract(
452452
[In] int bufferVertexCount,
453453
[In] IntPtr verticesPos, // (vertexCount) DirectX::XMFLOAT3*
@@ -460,7 +460,7 @@ public static extern int GeneratePlayspace_ExtractMesh_Extract(
460460
/// </summary>
461461
/// <param name="playspaceStats">playspace stats structure to receive the statistics data</param>
462462
/// <returns>Zero if fails, one if success</returns>
463-
[DllImport("SpatialUnderstanding")]
463+
[DllImport("SpatialUnderstanding", CallingConvention = CallingConvention.Cdecl)]
464464
public static extern int QueryPlayspaceStats(
465465
[In] IntPtr playspaceStats); // PlayspaceStats
466466

@@ -469,7 +469,7 @@ public static extern int QueryPlayspaceStats(
469469
/// </summary>
470470
/// <param name="playspaceAlignment">playspace alignment structure to receive the alignment data</param>
471471
/// <returns>Zero if fails, one if success</returns>
472-
[DllImport("SpatialUnderstanding")]
472+
[DllImport("SpatialUnderstanding", CallingConvention = CallingConvention.Cdecl)]
473473
public static extern int QueryPlayspaceAlignment(
474474
[In] IntPtr playspaceAlignment); // PlayspaceAlignment
475475

@@ -485,7 +485,7 @@ public static extern int QueryPlayspaceAlignment(
485485
/// <param name="rayVec_Z">Ray direction vector, z component. Length of ray indicates the length of the ray cast query.</param>
486486
/// <param name="result">Structure to receive the results of the raycast</param>
487487
/// <returns>Zero if fails or no intersection, one if an intersection is detected</returns>
488-
[DllImport("SpatialUnderstanding")]
488+
[DllImport("SpatialUnderstanding", CallingConvention = CallingConvention.Cdecl)]
489489
public static extern int PlayspaceRaycast(
490490
[In] float rayPos_X, [In] float rayPos_Y, [In] float rayPos_Z,
491491
[In] float rayVec_X, [In] float rayVec_Y, [In] float rayVec_Z,

Assets/HoloToolkit/SpatialUnderstanding/Scripts/SpatialUnderstandingDllObjectPlacement.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ public object Clone()
446446
/// scanning phase has finish and the playspace has been finalized.
447447
/// </summary>
448448
/// <returns></returns>
449-
[DllImport("SpatialUnderstanding")]
449+
[DllImport("SpatialUnderstanding", CallingConvention = CallingConvention.Cdecl)]
450450
public static extern int Solver_Init();
451451

452452
/// <summary>
@@ -470,7 +470,7 @@ public object Clone()
470470
/// <param name="placementConstraints">Array of ObjectPlacementConstraint structures, defining the constraints</param>
471471
/// <param name="placementResult">Pointer to an ObjectPlacementResult structure to receive the result of the query </param>
472472
/// <returns>Zero on failure, one on success</returns>
473-
[DllImport("SpatialUnderstanding")]
473+
[DllImport("SpatialUnderstanding", CallingConvention = CallingConvention.Cdecl)]
474474
public static extern int Solver_PlaceObject(
475475
[In, MarshalAs(UnmanagedType.LPStr)] string objectName,
476476
[In] IntPtr placementDefinition,// ObjectPlacementDefinition
@@ -488,7 +488,7 @@ public static extern int Solver_PlaceObject(
488488
/// </summary>
489489
/// <param name="objectName"></param>
490490
/// <returns></returns>
491-
[DllImport("SpatialUnderstanding")]
491+
[DllImport("SpatialUnderstanding", CallingConvention = CallingConvention.Cdecl)]
492492
public static extern int Solver_RemoveObject(
493493
[In, MarshalAs(UnmanagedType.LPStr)] string objectName);
494494

@@ -498,7 +498,7 @@ public static extern int Solver_RemoveObject(
498498
/// Objects placed with Solver_PlaceObject persist until removed
499499
/// and are considered in subsequent queries by some rules and constraints.
500500
/// </summary>
501-
[DllImport("SpatialUnderstanding")]
501+
[DllImport("SpatialUnderstanding", CallingConvention = CallingConvention.Cdecl)]
502502
public static extern void Solver_RemoveAllObjects();
503503
}
504504
}

Assets/HoloToolkit/SpatialUnderstanding/Scripts/SpatialUnderstandingDllShapes.cs

+5-5
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,7 @@ public static ShapeConstraint Create_AtRightOf(int componentIndexA, int componen
838838
/// <param name="shapeData">An array of ShapeResult structures to receive the results of the query</param>
839839
/// <returns>Number of positions found. This number will never exceed shapeCount (the space provided for the results in shapeData).</returns>
840840
// Queries (shapes)
841-
[DllImport("SpatialUnderstanding")]
841+
[DllImport("SpatialUnderstanding", CallingConvention = CallingConvention.Cdecl)]
842842
public static extern int QueryShape_FindPositionsOnShape(
843843
[In, MarshalAs(UnmanagedType.LPStr)] string shapeName, // char*
844844
[In] float minRadius,
@@ -853,7 +853,7 @@ public static extern int QueryShape_FindPositionsOnShape(
853853
/// <param name="shapeCount">Length of the array passed in shapeData, the return value will never exceed this value</param>
854854
/// <param name="shapeData">An array of ShapeResult structures to receive the results of the query</param>
855855
/// <returns>Number of shapes found. This number will never exceed shapeCount (the space provided for the results in shapeData).</returns>
856-
[DllImport("SpatialUnderstanding")]
856+
[DllImport("SpatialUnderstanding", CallingConvention = CallingConvention.Cdecl)]
857857
public static extern int QueryShape_FindShapeHalfDims(
858858
[In, MarshalAs(UnmanagedType.LPStr)] string shapeName, // char*
859859
[In] int shapeCount, // Pass in the space allocated in shapeData
@@ -870,7 +870,7 @@ public static extern int QueryShape_FindShapeHalfDims(
870870
/// <param name="shapeConstraints">Length of the shape constraint array passed in the constraints parameter</param>
871871
/// <param name="constraints">Array of ShapeConstraint structures</param>
872872
/// <returns></returns>
873-
[DllImport("SpatialUnderstanding")]
873+
[DllImport("SpatialUnderstanding", CallingConvention = CallingConvention.Cdecl)]
874874
public static extern int AddShape(
875875
[In, MarshalAs(UnmanagedType.LPStr)] string shapeName,
876876
[In] int componentCount,
@@ -882,13 +882,13 @@ public static extern int AddShape(
882882
/// Runs the shape analysis. This should be called after scanning has been
883883
/// finalized and shapes have been defined with AddShape.
884884
/// </summary>
885-
[DllImport("SpatialUnderstanding")]
885+
[DllImport("SpatialUnderstanding", CallingConvention = CallingConvention.Cdecl)]
886886
public static extern void ActivateShapeAnalysis();
887887

888888
/// <summary>
889889
/// Removes all shapes defined by AddShape.
890890
/// </summary>
891-
[DllImport("SpatialUnderstanding")]
891+
[DllImport("SpatialUnderstanding", CallingConvention = CallingConvention.Cdecl)]
892892
public static extern void RemoveAllShapes();
893893
}
894894
}

Assets/HoloToolkit/SpatialUnderstanding/Scripts/SpatialUnderstandingDllTopology.cs

+6-6
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public struct TopologyResult
4040
/// <param name="locationData">Location result array of TopologyResult to be filled with the spaces found by the query</param>
4141
/// <returns>Number of spaces found by the query. This value is limited by the number of results supplied by the caller (locationCount)</returns>
4242
// Queries (topology)
43-
[DllImport("SpatialUnderstanding")]
43+
[DllImport("SpatialUnderstanding", CallingConvention = CallingConvention.Cdecl)]
4444
public static extern int QueryTopology_FindPositionsOnWalls(
4545
[In] float minHeightOfWallSpace,
4646
[In] float minWidthOfWallSpace,
@@ -59,7 +59,7 @@ public static extern int QueryTopology_FindPositionsOnWalls(
5959
/// <param name="locationCount">Number of location results supplied by the user in locationData</param>
6060
/// <param name="locationData">Location result array of TopologyResult to be filled with the spaces found by the query</param>
6161
/// <returns>Number of spaces found by the query. This value is limited by the number of results supplied by the caller (locationCount)</returns>
62-
[DllImport("SpatialUnderstanding")]
62+
[DllImport("SpatialUnderstanding", CallingConvention = CallingConvention.Cdecl)]
6363
public static extern int QueryTopology_FindLargePositionsOnWalls(
6464
[In] float minHeightOfWallSpace,
6565
[In] float minWidthOfWallSpace,
@@ -73,7 +73,7 @@ public static extern int QueryTopology_FindLargePositionsOnWalls(
7373
/// </summary>
7474
/// <param name="wall">Pointer to a TopologyResult structure, to be filled with the found wall</param>
7575
/// <returns>Zero if fails, one if success</returns>
76-
[DllImport("SpatialUnderstanding")]
76+
[DllImport("SpatialUnderstanding", CallingConvention = CallingConvention.Cdecl)]
7777
public static extern int QueryTopology_FindLargestWall(
7878
[In, Out] IntPtr wall); // TopologyResult
7979

@@ -85,7 +85,7 @@ public static extern int QueryTopology_FindLargestWall(
8585
/// <param name="locationCount">Number of location results supplied by the user in locationData</param>
8686
/// <param name="locationData">Location result array of TopologyResult to be filled with the spaces found by the query</param>
8787
/// <returns>Number of spaces found by the query. This value is limited by the number of results supplied by the caller (locationCount)</returns>
88-
[DllImport("SpatialUnderstanding")]
88+
[DllImport("SpatialUnderstanding", CallingConvention = CallingConvention.Cdecl)]
8989
public static extern int QueryTopology_FindPositionsOnFloor(
9090
[In] float minLengthOfFloorSpace,
9191
[In] float minWidthOfFloorSpace,
@@ -98,7 +98,7 @@ public static extern int QueryTopology_FindPositionsOnFloor(
9898
/// <param name="locationCount">Number of location results supplied by the user in locationData</param>
9999
/// <param name="locationData">Location result array of TopologyResult to be filled with the spaces found by the query</param>
100100
/// <returns>Number of spaces found by the query. This value is limited by the number of results supplied by the caller (locationCount)</returns>
101-
[DllImport("SpatialUnderstanding")]
101+
[DllImport("SpatialUnderstanding", CallingConvention = CallingConvention.Cdecl)]
102102
public static extern int QueryTopology_FindLargestPositionsOnFloor(
103103
[In] int locationCount, // Pass in the space allocated in locationData
104104
[In, Out] IntPtr locationData); // TopologyResult
@@ -112,7 +112,7 @@ public static extern int QueryTopology_FindLargestPositionsOnFloor(
112112
/// <param name="locationCount">Number of location results supplied by the user in locationData</param>
113113
/// <param name="locationData">Location result array of TopologyResult to be filled with the spaces found by the query</param>
114114
/// <returns>Number of spaces found by the query. This value is limited by the number of results supplied by the caller (locationCount)</returns>
115-
[DllImport("SpatialUnderstanding")]
115+
[DllImport("SpatialUnderstanding", CallingConvention = CallingConvention.Cdecl)]
116116
public static extern int QueryTopology_FindPositionsSittable(
117117
[In] float minHeight,
118118
[In] float maxHeight,

0 commit comments

Comments
 (0)