@@ -327,40 +327,46 @@ enum InitMode : byte
327
327
// Handle to the C++ DLL
328
328
static IntPtr libraryHandle ;
329
329
330
+ [ UnmanagedFunctionPointer ( CallingConvention . Cdecl ) ]
330
331
delegate void InitDelegate (
331
332
IntPtr memory ,
332
333
int memorySize ,
333
334
InitMode initMode ) ;
334
335
336
+ [ UnmanagedFunctionPointer ( CallingConvention . Cdecl ) ]
335
337
public delegate void SetCsharpExceptionDelegate ( int handle ) ;
336
338
337
339
/*BEGIN CPP DELEGATES*/
340
+ [ UnmanagedFunctionPointer ( CallingConvention . Cdecl ) ]
338
341
public delegate int NewBaseBallScriptDelegateType ( int param0 ) ;
339
342
public static NewBaseBallScriptDelegateType NewBaseBallScript ;
340
343
344
+ [ UnmanagedFunctionPointer ( CallingConvention . Cdecl ) ]
341
345
public delegate void DestroyBaseBallScriptDelegateType ( int param0 ) ;
342
346
public static DestroyBaseBallScriptDelegateType DestroyBaseBallScript ;
343
347
348
+ [ UnmanagedFunctionPointer ( CallingConvention . Cdecl ) ]
344
349
public delegate void MyGameAbstractBaseBallScriptUpdateDelegateType ( int thisHandle ) ;
345
350
public static MyGameAbstractBaseBallScriptUpdateDelegateType MyGameAbstractBaseBallScriptUpdate ;
346
351
352
+ [ UnmanagedFunctionPointer ( CallingConvention . Cdecl ) ]
347
353
public delegate void SetCsharpExceptionSystemNullReferenceExceptionDelegateType ( int param0 ) ;
348
354
public static SetCsharpExceptionSystemNullReferenceExceptionDelegateType SetCsharpExceptionSystemNullReferenceException ;
349
355
/*END CPP DELEGATES*/
350
356
#endif
351
357
352
358
#if UNITY_EDITOR_OSX || UNITY_EDITOR_LINUX
353
- [ DllImport ( "__Internal" ) ]
359
+ [ DllImport ( "__Internal" , CallingConvention = CallingConvention . Cdecl ) ]
354
360
static extern IntPtr dlopen (
355
361
string path ,
356
362
int flag ) ;
357
363
358
- [ DllImport ( "__Internal" ) ]
364
+ [ DllImport ( "__Internal" , CallingConvention = CallingConvention . Cdecl ) ]
359
365
static extern IntPtr dlsym (
360
366
IntPtr handle ,
361
367
string symbolName ) ;
362
368
363
- [ DllImport ( "__Internal" ) ]
369
+ [ DllImport ( "__Internal" , CallingConvention = CallingConvention . Cdecl ) ]
364
370
static extern int dlclose (
365
371
IntPtr handle ) ;
366
372
@@ -395,16 +401,16 @@ static T GetDelegate<T>(
395
401
typeof ( T ) ) as T ;
396
402
}
397
403
#elif UNITY_EDITOR_WIN
398
- [ DllImport ( "kernel32" ) ]
404
+ [ DllImport ( "kernel32" , SetLastError = true , CharSet = CharSet . Ansi ) ]
399
405
static extern IntPtr LoadLibrary (
400
406
string path ) ;
401
407
402
- [ DllImport ( "kernel32" ) ]
408
+ [ DllImport ( "kernel32" , CharSet = CharSet . Ansi , ExactSpelling = true , SetLastError = true ) ]
403
409
static extern IntPtr GetProcAddress (
404
410
IntPtr libraryHandle ,
405
411
string symbolName ) ;
406
412
407
- [ DllImport ( "kernel32" ) ]
413
+ [ DllImport ( "kernel32.dll" , SetLastError = true ) ]
408
414
static extern bool FreeLibrary (
409
415
IntPtr libraryHandle ) ;
410
416
@@ -437,86 +443,145 @@ static T GetDelegate<T>(
437
443
typeof ( T ) ) as T ;
438
444
}
439
445
#else
440
- [ DllImport ( PLUGIN_NAME ) ]
446
+ [ DllImport ( PLUGIN_NAME , CallingConvention = CallingConvention . Cdecl ) ]
441
447
static extern void Init (
442
448
IntPtr memory ,
443
449
int memorySize ,
444
450
InitMode initMode ) ;
445
451
446
- [ DllImport ( PLUGIN_NAME ) ]
452
+ [ DllImport ( PLUGIN_NAME , CallingConvention = CallingConvention . Cdecl ) ]
447
453
static extern void SetCsharpException ( int handle ) ;
448
454
449
455
/*BEGIN IMPORTS*/
450
- [ DllImport ( PLUGIN_NAME ) ]
456
+ [ DllImport ( PLUGIN_NAME , CallingConvention = CallingConvention . Cdecl ) ]
451
457
public static extern int NewBaseBallScript ( int thisHandle ) ;
452
458
453
- [ DllImport ( PLUGIN_NAME ) ]
459
+ [ DllImport ( PLUGIN_NAME , CallingConvention = CallingConvention . Cdecl ) ]
454
460
public static extern void DestroyBaseBallScript ( int thisHandle ) ;
455
461
456
- [ DllImport ( PLUGIN_NAME ) ]
462
+ [ DllImport ( PLUGIN_NAME , CallingConvention = CallingConvention . Cdecl ) ]
457
463
public static extern void MyGameAbstractBaseBallScriptUpdate ( int thisHandle ) ;
458
464
459
- [ DllImport ( PLUGIN_NAME ) ]
465
+ [ DllImport ( PLUGIN_NAME , CallingConvention = CallingConvention . Cdecl ) ]
460
466
public static extern void SetCsharpExceptionSystemNullReferenceException ( int thisHandle ) ;
461
467
/*END IMPORTS*/
462
468
#endif
463
469
470
+ [ UnmanagedFunctionPointer ( CallingConvention . Cdecl ) ]
464
471
delegate void ReleaseObjectDelegateType ( int handle ) ;
472
+
473
+ [ UnmanagedFunctionPointer ( CallingConvention . Cdecl ) ]
465
474
delegate int StringNewDelegateType ( string chars ) ;
475
+
476
+ [ UnmanagedFunctionPointer ( CallingConvention . Cdecl ) ]
466
477
delegate void SetExceptionDelegateType ( int handle ) ;
478
+
479
+ [ UnmanagedFunctionPointer ( CallingConvention . Cdecl ) ]
467
480
delegate int ArrayGetLengthDelegateType ( int handle ) ;
481
+
482
+ [ UnmanagedFunctionPointer ( CallingConvention . Cdecl ) ]
468
483
delegate int EnumerableGetEnumeratorDelegateType ( int handle ) ;
469
484
470
485
/*BEGIN DELEGATE TYPES*/
486
+ [ UnmanagedFunctionPointer ( CallingConvention . Cdecl ) ]
471
487
delegate void ReleaseSystemDecimalDelegateType ( int handle ) ;
488
+ [ UnmanagedFunctionPointer ( CallingConvention . Cdecl ) ]
472
489
delegate int SystemDecimalConstructorSystemDoubleDelegateType ( double value ) ;
490
+ [ UnmanagedFunctionPointer ( CallingConvention . Cdecl ) ]
473
491
delegate int SystemDecimalConstructorSystemUInt64DelegateType ( ulong value ) ;
492
+ [ UnmanagedFunctionPointer ( CallingConvention . Cdecl ) ]
474
493
delegate int BoxDecimalDelegateType ( int valHandle ) ;
494
+ [ UnmanagedFunctionPointer ( CallingConvention . Cdecl ) ]
475
495
delegate int UnboxDecimalDelegateType ( int valHandle ) ;
496
+ [ UnmanagedFunctionPointer ( CallingConvention . Cdecl ) ]
476
497
delegate UnityEngine . Vector3 UnityEngineVector3ConstructorSystemSingle_SystemSingle_SystemSingleDelegateType ( float x , float y , float z ) ;
498
+ [ UnmanagedFunctionPointer ( CallingConvention . Cdecl ) ]
477
499
delegate UnityEngine . Vector3 UnityEngineVector3Methodop_AdditionUnityEngineVector3_UnityEngineVector3DelegateType ( ref UnityEngine . Vector3 a , ref UnityEngine . Vector3 b ) ;
500
+ [ UnmanagedFunctionPointer ( CallingConvention . Cdecl ) ]
478
501
delegate int BoxVector3DelegateType ( ref UnityEngine . Vector3 val ) ;
502
+ [ UnmanagedFunctionPointer ( CallingConvention . Cdecl ) ]
479
503
delegate UnityEngine . Vector3 UnboxVector3DelegateType ( int valHandle ) ;
504
+ [ UnmanagedFunctionPointer ( CallingConvention . Cdecl ) ]
480
505
delegate int UnityEngineObjectPropertyGetNameDelegateType ( int thisHandle ) ;
506
+ [ UnmanagedFunctionPointer ( CallingConvention . Cdecl ) ]
481
507
delegate void UnityEngineObjectPropertySetNameDelegateType ( int thisHandle , int valueHandle ) ;
508
+ [ UnmanagedFunctionPointer ( CallingConvention . Cdecl ) ]
482
509
delegate int UnityEngineComponentPropertyGetTransformDelegateType ( int thisHandle ) ;
510
+ [ UnmanagedFunctionPointer ( CallingConvention . Cdecl ) ]
483
511
delegate UnityEngine . Vector3 UnityEngineTransformPropertyGetPositionDelegateType ( int thisHandle ) ;
512
+ [ UnmanagedFunctionPointer ( CallingConvention . Cdecl ) ]
484
513
delegate void UnityEngineTransformPropertySetPositionDelegateType ( int thisHandle , ref UnityEngine . Vector3 value ) ;
514
+ [ UnmanagedFunctionPointer ( CallingConvention . Cdecl ) ]
485
515
delegate int SystemCollectionsIEnumeratorPropertyGetCurrentDelegateType ( int thisHandle ) ;
516
+ [ UnmanagedFunctionPointer ( CallingConvention . Cdecl ) ]
486
517
delegate bool SystemCollectionsIEnumeratorMethodMoveNextDelegateType ( int thisHandle ) ;
518
+ [ UnmanagedFunctionPointer ( CallingConvention . Cdecl ) ]
487
519
delegate int UnityEngineGameObjectMethodAddComponentMyGameBaseBallScriptDelegateType ( int thisHandle ) ;
520
+ [ UnmanagedFunctionPointer ( CallingConvention . Cdecl ) ]
488
521
delegate int UnityEngineGameObjectMethodCreatePrimitiveUnityEnginePrimitiveTypeDelegateType ( UnityEngine . PrimitiveType type ) ;
522
+ [ UnmanagedFunctionPointer ( CallingConvention . Cdecl ) ]
489
523
delegate void UnityEngineDebugMethodLogSystemObjectDelegateType ( int messageHandle ) ;
524
+ [ UnmanagedFunctionPointer ( CallingConvention . Cdecl ) ]
490
525
delegate int UnityEngineMonoBehaviourPropertyGetTransformDelegateType ( int thisHandle ) ;
526
+ [ UnmanagedFunctionPointer ( CallingConvention . Cdecl ) ]
491
527
delegate int SystemExceptionConstructorSystemStringDelegateType ( int messageHandle ) ;
528
+ [ UnmanagedFunctionPointer ( CallingConvention . Cdecl ) ]
492
529
delegate int BoxPrimitiveTypeDelegateType ( UnityEngine . PrimitiveType val ) ;
530
+ [ UnmanagedFunctionPointer ( CallingConvention . Cdecl ) ]
493
531
delegate UnityEngine . PrimitiveType UnboxPrimitiveTypeDelegateType ( int valHandle ) ;
532
+ [ UnmanagedFunctionPointer ( CallingConvention . Cdecl ) ]
494
533
delegate float UnityEngineTimePropertyGetDeltaTimeDelegateType ( ) ;
534
+ [ UnmanagedFunctionPointer ( CallingConvention . Cdecl ) ]
495
535
delegate void BaseBallScriptConstructorDelegateType ( int cppHandle , ref int handle ) ;
536
+ [ UnmanagedFunctionPointer ( CallingConvention . Cdecl ) ]
496
537
delegate void ReleaseBaseBallScriptDelegateType ( int handle ) ;
538
+ [ UnmanagedFunctionPointer ( CallingConvention . Cdecl ) ]
497
539
delegate int BoxBooleanDelegateType ( bool val ) ;
540
+ [ UnmanagedFunctionPointer ( CallingConvention . Cdecl ) ]
498
541
delegate bool UnboxBooleanDelegateType ( int valHandle ) ;
542
+ [ UnmanagedFunctionPointer ( CallingConvention . Cdecl ) ]
499
543
delegate int BoxSByteDelegateType ( sbyte val ) ;
544
+ [ UnmanagedFunctionPointer ( CallingConvention . Cdecl ) ]
500
545
delegate sbyte UnboxSByteDelegateType ( int valHandle ) ;
546
+ [ UnmanagedFunctionPointer ( CallingConvention . Cdecl ) ]
501
547
delegate int BoxByteDelegateType ( byte val ) ;
548
+ [ UnmanagedFunctionPointer ( CallingConvention . Cdecl ) ]
502
549
delegate byte UnboxByteDelegateType ( int valHandle ) ;
550
+ [ UnmanagedFunctionPointer ( CallingConvention . Cdecl ) ]
503
551
delegate int BoxInt16DelegateType ( short val ) ;
552
+ [ UnmanagedFunctionPointer ( CallingConvention . Cdecl ) ]
504
553
delegate short UnboxInt16DelegateType ( int valHandle ) ;
554
+ [ UnmanagedFunctionPointer ( CallingConvention . Cdecl ) ]
505
555
delegate int BoxUInt16DelegateType ( ushort val ) ;
556
+ [ UnmanagedFunctionPointer ( CallingConvention . Cdecl ) ]
506
557
delegate ushort UnboxUInt16DelegateType ( int valHandle ) ;
558
+ [ UnmanagedFunctionPointer ( CallingConvention . Cdecl ) ]
507
559
delegate int BoxInt32DelegateType ( int val ) ;
560
+ [ UnmanagedFunctionPointer ( CallingConvention . Cdecl ) ]
508
561
delegate int UnboxInt32DelegateType ( int valHandle ) ;
562
+ [ UnmanagedFunctionPointer ( CallingConvention . Cdecl ) ]
509
563
delegate int BoxUInt32DelegateType ( uint val ) ;
564
+ [ UnmanagedFunctionPointer ( CallingConvention . Cdecl ) ]
510
565
delegate uint UnboxUInt32DelegateType ( int valHandle ) ;
566
+ [ UnmanagedFunctionPointer ( CallingConvention . Cdecl ) ]
511
567
delegate int BoxInt64DelegateType ( long val ) ;
568
+ [ UnmanagedFunctionPointer ( CallingConvention . Cdecl ) ]
512
569
delegate long UnboxInt64DelegateType ( int valHandle ) ;
570
+ [ UnmanagedFunctionPointer ( CallingConvention . Cdecl ) ]
513
571
delegate int BoxUInt64DelegateType ( ulong val ) ;
572
+ [ UnmanagedFunctionPointer ( CallingConvention . Cdecl ) ]
514
573
delegate ulong UnboxUInt64DelegateType ( int valHandle ) ;
574
+ [ UnmanagedFunctionPointer ( CallingConvention . Cdecl ) ]
515
575
delegate int BoxCharDelegateType ( char val ) ;
576
+ [ UnmanagedFunctionPointer ( CallingConvention . Cdecl ) ]
516
577
delegate char UnboxCharDelegateType ( int valHandle ) ;
578
+ [ UnmanagedFunctionPointer ( CallingConvention . Cdecl ) ]
517
579
delegate int BoxSingleDelegateType ( float val ) ;
580
+ [ UnmanagedFunctionPointer ( CallingConvention . Cdecl ) ]
518
581
delegate float UnboxSingleDelegateType ( int valHandle ) ;
582
+ [ UnmanagedFunctionPointer ( CallingConvention . Cdecl ) ]
519
583
delegate int BoxDoubleDelegateType ( double val ) ;
584
+ [ UnmanagedFunctionPointer ( CallingConvention . Cdecl ) ]
520
585
delegate double UnboxDoubleDelegateType ( int valHandle ) ;
521
586
/*END DELEGATE TYPES*/
522
587
0 commit comments