ld search path

Windows specific questions.
Post Reply
srvaldez
Posts: 3373
Joined: Sep 25, 2005 21:54

ld search path

Post by srvaldez »

in reference to viewtopic.php?f=3&t=28882
srvaldez wrote:ok, suppose that you have FreeBasic installed in E:\dev\FreeBasic and there's a certain library that your program needs but that's not in the FB lib folder neither is the lib where the program source code is located
if you are compiling to 64-bit then if you have E:\mingw64\lib\your_lib.a then the linker will use that library, likewise for the 32-bit version you would need E:\mingw32\lib\your_lib.a
I don't know if this works for others but it works on my system, it's actually quite handy, say that you have several versions of FreeBasic and you have some common libraries that you may need, you could just have them in mingw64\lib and mingw32\lib and any of your FB versions will use those libraries automatically
the behavior mentioned only works with my build of ld viewtopic.php?f=6&t=27859
I tried to determine the search path by trial & error, I found that if the lib is not in FB\lib that the FB installation path is not taken in consideration but the path of the source code that you are trying to compile
for example, suppose that you have your_program.bas in X:\dev\FBprograms\your_program.bas and FreeBasic is in C:\Users\your_name\Desktop\FreeBASIC-1.07.1-win64 and your_program links against a library that's not in the FB lib folder but the library is in X:\mingw64\lib then it will link against the library found in the mingw lib folder
I don't know if this behavior of ld is due to the more recent version or because how I built ld, I am inclined to think that it's due to the version
exagonx
Posts: 314
Joined: Mar 20, 2009 17:03
Location: Italy
Contact:

Re: ld search path

Post by exagonx »

Did you try with :

Code: Select all

	#IF DEFINED(__FB_WIN32__)
	#LIBPATH "E:\mingw32\lib" 
	#ELSE
	#LIBPATH "/usr/lib"
	#ENDIF
srvaldez wrote:in reference to viewtopic.php?f=3&t=28882
srvaldez wrote:ok, suppose that you have FreeBasic installed in E:\dev\FreeBasic and there's a certain library that your program needs but that's not in the FB lib folder neither is the lib where the program source code is located
if you are compiling to 64-bit then if you have E:\mingw64\lib\your_lib.a then the linker will use that library, likewise for the 32-bit version you would need E:\mingw32\lib\your_lib.a
I don't know if this works for others but it works on my system, it's actually quite handy, say that you have several versions of FreeBasic and you have some common libraries that you may need, you could just have them in mingw64\lib and mingw32\lib and any of your FB versions will use those libraries automatically
the behavior mentioned only works with my build of ld viewtopic.php?f=6&t=27859
I tried to determine the search path by trial & error, I found that if the lib is not in FB\lib that the FB installation path is not taken in consideration but the path of the source code that you are trying to compile
for example, suppose that you have your_program.bas in X:\dev\FBprograms\your_program.bas and FreeBasic is in C:\Users\your_name\Desktop\FreeBASIC-1.07.1-win64 and your_program links against a library that's not in the FB lib folder but the library is in X:\mingw64\lib then it will link against the library found in the mingw lib folder
I don't know if this behavior of ld is due to the more recent version or because how I built ld, I am inclined to think that it's due to the version
Post Reply