title: How can I statically link a dylib to my program on macOS?
body: <p>my c program calls:</p>
  
  <p>hLibrary = dlopen("libPCBUSB.dylib", RTLD_LAZY);</p>
  
  <p>and I seem to need this file in the directory when I run the executable after calling <code>gcc main.c</code>.</p>
  
  <p>i.e. I run <code>./a.out</code> and it all works as long as the dylib is in that directory.</p>
  
  <p>In order to produce an executable with that dylib statically built in I've been trying all sorts of linking options but failing.</p>
  
  <p>What is the correct way to compile my c program (in macOS Darwin not linux) to include this lib so the end user will not need it on their Mac?</p>