I'm one. I try to use the function in Unity 3D from the bundle file, but whenever I call the function, I receive an error:
DllNotFoundException: libant connectant.start () (properties / Connecting .cs: 13)
This is the script I use to call the library Antlib.bundle in the property / plugin folder:
using UnityEngine; Using System.Collections; Using System.Runtime.InteropServices; Public category coordinator: Monobehavier {[DllImport ("libant") Static Extra Bull ANET (Int ucUSBDeviceNum_, int ulBaudrate_); Zero Starter () {ANT_Init (1, 50000); }}
In this bundle this function has been declared as:
#ifdef __cplusplus extern "c" {#endif export bullion_nit (ukru ucUSBDeviceNum_ , Ulenge Ubodod__); // module starts and opens the USI connection #ifdef __cplusplus} #endif
This is an example with only one function from the bundle. If I only import functions in my script, then I can not find any error in Unity. Can anyone help me remove it?
Try this:
[DllImport ("antlib.bundle ")] Fixed extern int ANT_Init (byte ucUSBDeviceNum_, uint ulBaudrate_);
There are two problems with your code:
- Wrong file name
- Wrong logic type and return type
If you want to use bool as the return type, then another feature is required:
[Return: System. Runtime Interp Services MursalAsTribute (System Runtime. Interp Services .bool)] [DllImport ("antlib.bundle")] Fixed External Bull ANT_Init (Byte ucUSBDeviceNum_, uint ulBaudrate_);
No comments:
Post a Comment