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
649 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
6 Comments
 
LVL 38

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 78

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 38

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
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 
LVL 78

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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

Suggested Solutions

This guide will walk you through the essential considerations and tech stack for building scalable websites. Know how to grow your business the smart way!
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will giveā€¦
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.
An overview on how to enroll an hourly employee into the employee database and how to give them access into the clock in terminal.

751 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