title: How to link host code with a static CUDA library after separable compilation?
body: <p>Alright, I have a really troubling CUDA 5.0 question about how to link things properly. I'd be really grateful for any assistance!</p>
  
  <p>Using the separable compilation features of CUDA 5.0, I generated a static library (*.a). This nicely links with other *.cu files when run through nvcc, I have done this many times.</p>
  
  <p>I'd now like to take a *.cpp file and link it against the host code in this static library using g++ or whatever, but not nvcc. If I attempt this, I get compiler errors like </p>
  
  <blockquote>
    <p>undefined reference to __cudaRegisterLinkedBinary</p>
  </blockquote>
  
  <p>I'm using both <code>-lcuda</code> and <code>-lcudart</code> and, to my knowledge, have the libraries in the correct order (meaning <code>-lmylib -lcuda -lcudart</code>). I don't think it is an issue with that. Maybe I'm wrong, but I feel I'm missing a step and that I need to do something else to my static library (device linking?) before I can use it with g++.</p>
  
  <p>Have I missed something crucial? Is this even possible?</p>
  
  <p>Bonus question: I want the end result to be a dynamic library. How can I achieve this?</p>