3

Is it possible to create a .dylib file from a Objective-C or Swift coded-project, or must the code be written in C++?

I've seen several sources, but they're all written in C++.

see - Creating and Using a Simple .dylib and How do I create a dynamic library (dylib) with Xcode?

Is it even possible to create a .dylib file using any other language than c++?

3
  • 1
    That's possible at least for OS X. I use this approach in one my project. If you are interested in, I can prepare sample project to you. Commented Apr 26, 2016 at 12:45
  • if possible that would be great! @Melifaro Commented Apr 26, 2016 at 12:45
  • 2
    Ok then, give me 5 minutes :) Commented Apr 26, 2016 at 12:46

1 Answer 1

3

As we discussed I have created an sample app for OS X. It uses dylib with single Foo Swift class. Foo has doSomething method, which logs kind of "hello world" message into the console.

Once you are built the project, you can find the dynamic library inside the application bundle in the Frameworks folder. It named libFoo.dylib.

Source code: https://github.com/melifaro-/OSXDylibSample

Hope it helps.

Sign up to request clarification or add additional context in comments.

1 Comment

Is it possible to call the dylib written by Swift from C++ code?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.