#Linking to `.dylib` - how to do it properly?

1 messages · Page 1 of 1 (latest)

half ingot
#

What is the valid way of linking to .dylib on MacOS? I have something like that, but I don't think it is the valid way:

exe.addSystemIncludePath("/opt/homebrew/include");
exe.addObjectFile("/opt/homebrew/lib/libmpi.dylib");
exe.linkLibC();
glass coral
#

If I recall it’s something like “addLibraryPath” and then “addLibFile”. You can find the proper functions inside the zig repo main “Build” file. Other things to note: it doesn’t error just ignores if the library isn’t found unfortunately. I believe it works like gcc where when you include a lib you have to drop the “lib” part. So you login just add “mpi” and that’s it. (Also don’t add the path after you’ve included the path.).#with zig I’ve had weird success in that as soon as I add a c file and the addLibraryPath it just adds it without even pointing to it. So keep experimenting. 🙂

sturdy topaz
#

Probably want linkSystemLibrary("mpi") for this one.

#

Since you used addSystemIncludePath.