How to correctly integrate D library to Swift/Obj-C mobile project?

Jacob Carlborg doob at me.com
Wed Jun 24 12:00:04 UTC 2020


On Monday, 22 June 2020 at 14:32:21 UTC, Anton wrote:
> I have a static library (.a) compiled with LDC for iOS 
> platform. But I can't figure out how to correctly connect it to 
> the project and call its functions. I've already linked binary 
> with library to the project but IDE still doesn't see its 
> classes and methods. Do I need to do some additional 
> configurations?

When you say "IDE", I'm going to assume you're referring to 
Xcode. Xcode has absolutely no support for D at all.

Since the Objective-C support in LDC is so limited I would 
recommend creating `extern(C)` functions in the D code, which 
forwards to your D functions (or have the functions being 
`extern(C)` to begin with). Then you need to have these 
declarations available in a C header file, either created by 
using the `-HC` flag or by manually writing the declarations.

--
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list