Hacker News new | ask | show | jobs
by cbrauchli 3381 days ago
That's not true at all. You can use dynamic libraries; Swift modules produce .framework packages, which are dynamically linked.
1 comments

I meant dylib files. You can't ship those, but you can ship dynamically linked frameworks.
AFAIK the only difference between a dylib and a framework is the folder structure (and I guess the install path of the library). So in theory you could produce a cdylib, create a framework folder structure for it, and then use install_name_tool to update the install name appropriately.
That's what I thought, too, but I was reminded of the filetype field in the mach_header which has distinct MH_DYLIB and MH_BUNDLE values. fwiw, I don't think that difference means much for the loading process, but they are different.
Hmm. I just ran `otool -hv /System/Library/Frameworks/Foundation.framework/Foundation` and it says the "filetype" header has the value "DYLIB". It looks like MH_BUNDLE is actually for plugin bundles, not for frameworks.
Oh, I see! That makes sense. Preference bundles are type "BUNDLE" but frameworks are not. TIL.
Ah, I see. Thanks for the clarification.