- Home /
Importing object type from .so lib
Hi,
How do you import an object type into Unity? For instance, let's say I have a .so library written in C/C++ with this inside:
Lib:
typedef struct myObject{
// some stuff here
} myObject;
Then what do I do in Unity to get this back?
[DllImport("mylib")]
// Something?
If needed, yes I've looked it up on the internet, read the Unity documentation, other threads etc... the only thing I have found was this and it didn't help me because I don't know what's inside myObject and I don't need to.
Any help would be appreciated. Thanks
In order to clarify, my .so file contains a method that builds a new myObject.
Lib:
public myObject new$$anonymous$$yObject(); // Constructs a new myObject
Only I can't use it like this in Unity:
[DllImport("lib")]
private static extern myObject new$$anonymous$$yObject();
Because Unity doesn't know what myObject is, and thus I can't get it from my lib. That's why I need to import the myObject type in Unity.
Answer by Thugann · May 27, 2016 at 11:43 AM
Anyone?
I've been struggling with this for a while now, is it even possible to do what I'm asking?
Your answer
![](https://koobas.hobune.stream/wayback/20220612081614im_/https://answers.unity.com/themes/thub/images/avi.jpg)