stair314
June 27th, 2009, 02:22 AM
Say that I want to link foo.cpp against a library bar. I've found that if I declare a function myFunc() in bar but don't define it, I can use bar.a as long as foo.cpp doesn't call myFunc(), but if I try to use bar.so I will get an undefined reference error.
Is this because there is a requirement that dynamic libraries define all the functions they declare and no such requirement for static libraries, or have I botched something else up?
The reason I am doing this is that some of the functions in bar are based on CUDA and I want it to be possible to compile on the cpp part of bar on machines that don't have CUDA.
Is this because there is a requirement that dynamic libraries define all the functions they declare and no such requirement for static libraries, or have I botched something else up?
The reason I am doing this is that some of the functions in bar are based on CUDA and I want it to be possible to compile on the cpp part of bar on machines that don't have CUDA.