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
632 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, EE MVE
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 77

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, EE MVE
ID: 38772188
@arnold - cygwin is Windows env. so why the /etc/ld.so.conf if I may ask>
0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
LVL 77

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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

All of the resources available today make learning a new digital media easier than ever-- if you know where to begin. This is a clear, simple guide to a few of the basic digital art mediums and how to begin learning them on your own.
Developer portfolios can be a bit of an enigma—how do you present yourself to employers without burying them in lines of code?  A modern portfolio is more than just work samples, it’s also a statement of how you work.
Video by: Tony
This video teaches viewers how to export a project from Adobe Premiere Pro and the various file types involved.
Using Adobe Premiere Pro, the viewer will learn how to set up a sequence with proper settings, importing pictures, rendering, and exporting the finished product.

777 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