• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 695
  • Last Modified:

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

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
longjumps
Asked:
longjumps
  • 2
  • 2
  • 2
1 Solution
 
Gerwin Jansen, EE MVETopic Advisor Commented:
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
 
arnoldCommented:
Look within /etc/ld.so.conf. Make sure the rider of the paths is inthe search order you want.
1
2
3
.
.
.
0
 
Gerwin Jansen, EE MVETopic Advisor Commented:
@arnold - cygwin is Windows env. so why the /etc/ld.so.conf if I may ask>
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
arnoldCommented:
It tries to mimic Linux, you need to alter the search path, or statically compile the exe to rely on a library.
0
 
longjumpsAuthor Commented:
-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
 
longjumpsAuthor Commented:
I provide accurate solution. None of experts did this.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

  • 2
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now