Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by CherryQu · Mar 23, 2012 at 07:37 AM · pluginosxdllnotfoundexceptionbundle

DLLNotFoundException, trying to build bundle from .a library on OSX

Hi all, I think I've met with a tricky problem.

I am on Mac OS Lion and I want to use Xcode 4 to build a bundle plugin for Unity Pro. The c code that I want to reuse is a bunch of .h and .c files that are supposed to be build by the make tools. I tried to build a Cocoa bundle with the C source files but failed. I then tried to use the .a library that make builds and I build that .a file into a bundle in Xcode. This time the build succeeded but when I was trying to call a function defined in the C source code, Unity gives me a runtime DLLNotFoundException.

Can someone please help me?

Here is detailed description of what I did:

  1. I built a Cocoa bundle. The only effective component is a library called libccn.a so I guess in theory whatever function defined in the header ccn.h should be available for me after I imported the plugin. This is the definition of the function I called in ccn.h file: int ccn_run(struct ccn *h, int timeout);

  2. I put the bundle in Unity's Plugin folder

  3. This is my C# script

    using UnityEngine; using System; using System.Collections; using System.Runtime.InteropServices;

    public class PluginScript : MonoBehaviour {

      [StructLayout(LayoutKind.Auto)]
         public struct CCN
         {
         }
         
         [DllImport("CCNxB")]
         public static extern int ccn_run(ref CCN ccn, int timeout);
         
         void Start () {
             CCN ccn = new CCN();
             ccn_run(ref ccn, 1);
         }
     }
    
    

Here is a summary of my questions:

  1. I thought Unity can't use .a libraries directly, am I right?

  2. Can Unity use bundles built from .a libraries? Has anyone done that before?

  3. If Unity can recognize bundles built from .a library, could anyone give me some hint about what I am doing wrong now?

Many thanks in advance!

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image GameFreak · Mar 23, 2012 at 07:44 PM 0
Share

I had bought a gamecenter plugin. It had a .a library plugin.

I even had to import it in xcode to link it to the library. (Drag it into xcode)

So surely unity can undertand them.

avatar image CherryQu · Mar 23, 2012 at 08:00 PM 0
Share

Great! But could you give me more hint about how to import .a library into Unity then? When it is a .bundle plug-in, I can use [DllImport]... But I don't know what to do with a .a library...

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by GameFreak · Mar 23, 2012 at 08:20 PM

Its gonna be a bit long so I ll just post it as an answer rather than a comment

Firstly, I am not an expert so I will try my best to understand and tell you how they have used it in the plugin.

They have the .a file here Assets --> Editor --> GameCenter --> libGameCenterPlugin.a

Then in Plugins-->GameCenter they have a c# script with several [DllImport ("__Internal")]

about which you can read here

http://unity3d.com/support/documentation/Manual/Plugins.html

Then finally they have given this instruction

Build After make Unity XCode project link project with library "Assets/Editor/GameCenter/ libGameCenterPlugin.a"

(basically just drag it into Xcode)

I dont know if I can help more.

I told you what I understood

IF YOU DO WANT THE C# SCRIPT GIVE ME YOUR EMAIL. Even though it has nothing it is copyrighted and I dont want to get into trouble by posting it here.

heers

Rishab.

Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image CherryQu · Mar 23, 2012 at 09:38 PM 0
Share

Also I don't quite understand the instruction they gave (Build After make Unity XCode project link project with library "Assets/Editor/GameCenter/ libGameCenterPlugin.a")

You said you dragged the .a library into Xcode. But are you supposed to build an Xcode project? Isn't the library already in Unity? I thought if the static library is already in Unity and they already have a C# script that imports it, you won't need to build any Xcode project...

So could you tell me more about that? Thanks a lot!

avatar image GameFreak · Mar 24, 2012 at 06:52 AM 0
Share

Tickmark my answer so that the question is closed.

I have sent you email lets talk there.

avatar image CherryQu · Mar 24, 2012 at 07:10 AM 0
Share

alright~ I ticked :)

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Unity fails to include .bundle for native code plugin when building Intel Mac player. 0 Answers

What to choose to make .bundle plugin in XCode? 1 Answer

Why doesn't my bundle build for Mac OS X using Xcode 4.5? 1 Answer

Does Unity 5 support OSX i386 plugins (without x86_64)? 0 Answers

FileNotFoundException: Could not load file or assembly 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges