Solved

cywin - How to force my exe to use "regcomp" and "regexec" funcs from my lib and not libc?

Posted on 2013-01-12
6
603 Views
Last Modified: 2013-11-15
I compiled library libregex.a and testprogram .exe in cywin.

gcc -o testprogram runtests.c -L/home/Semyon/work/src/regex/2.7/regex-2.7-src/src/.libs/libregex.a

Once I run "testprogram.exe" it takes functions "regcomp" and "regexec" from libc and not my compiled lib.

How to force "testprogram.exe" to take those functions from my lib libregex.a?
0
Comment
Question by:longjumps
  • 2
  • 2
  • 2
6 Comments
 
LVL 37

Expert Comment

by:Gerwin Jansen
ID: 38771961
Can you try and put both the testprogram and your compiled library in the same folder and try then? If that doesn't work, try setting the PATH like this: set PATH=.\;%PATH% and try again. Put testprogram and library into your current folder.
0
 
LVL 76

Expert Comment

by:arnold
ID: 38772057
Look within /etc/ld.so.conf. Make sure the rider of the paths is inthe search order you want.
1
2
3
.
.
.
0
 
LVL 37

Expert Comment

by:Gerwin Jansen
ID: 38772188
@arnold - cygwin is Windows env. so why the /etc/ld.so.conf if I may ask>
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 76

Expert Comment

by:arnold
ID: 38772226
It tries to mimic Linux, you need to alter the search path, or statically compile the exe to rely on a library.
0
 
LVL 1

Accepted Solution

by:
longjumps earned 0 total points
ID: 38777188
-L was wrong used in the command.
Since -L should provide only path to lib and not lib itself.

When deleting -L and link as is, my functions from my lib were executed and not libc.

gcc -o testprogram runtests.c /home/Semyon/work/src/regex/2.7/regex-2.7-src/src/.libs/libregex.a
0
 
LVL 1

Author Closing Comment

by:longjumps
ID: 38796111
I provide accurate solution. None of experts did this.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

Storage devices are generally used to save the data or sometime transfer the data from one computer system to another system. However, sometimes user accidentally erased their important data from the Storage devices. Users have to know how data reco…
Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
This video demonstrates basic masking and how to edit the mask to reveal the desired image.
Video by: Tony
This video teaches viewers how to export a project from Adobe Premiere Pro and the various file types involved.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now