Thread: Regexec() & regcomp(). In which library do they reside?

  1. #1
    Registered User
    Join Date
    Jun 2009
    Posts
    24

    Regexec() & regcomp(). In which library do they reside?

    Hi,

    I'm using the Android NDK to compile some C code however during compile time it complains of undefined references to regcomp() and regexec() (Regular expression functions).

    The Android NDK is a stripped down C environment and it's possible these functions are not available but to check this could someone tell me in which library they reside on a standard (Linux) C environment?

  2. #2
    Registered User
    Join Date
    Aug 2003
    Posts
    1,218
    They are part of POSIX. If the NDK doesn't have the regex.h header you most likely do not have these functions.

    Just a curious question, why doing C development for Android? As far as I know your program will still run under the virtual machine that all programs run on in android, and since java has a much bigger framework it doesn't really make sense for me. Or is it just a matter of doing it to poke around and because it is fun?

  3. #3
    Registered User
    Join Date
    Jun 2009
    Posts
    24
    Quote Originally Posted by Shakti View Post
    They are part of POSIX. If the NDK doesn't have the regex.h header you most likely do not have these functions.

    Just a curious question, why doing C development for Android? As far as I know your program will still run under the virtual machine that all programs run on in android, and since java has a much bigger framework it doesn't really make sense for me. Or is it just a matter of doing it to poke around and because it is fun?
    Hello Shakti,

    Thanks for your quick reply. I did think they should be part of POSIX but I've just discovered that the Android NDK does give me the regex.h and includes the functions I need. Checking the source code I have it appears not to #include regex for some weird reason! (Even though I've compiled this very same code for the build machine ok)

    The reason I'm doing C work for Android is because I need to access some remote devices via a network. Unfortunately the protocol they use is buried in the source code for the Linux drivers and I didn't want the laborious of wading though it to try and work it out. Much better to try and compile what I do have under the android NDK and use that.

  4. #4
    Registered User
    Join Date
    Aug 2003
    Posts
    1,218
    Is it a linker error or a compiler error you are getting?

    this might shed some light on the issue, it is a little dated but might still be relevant:
    Regular expression support in Android - android-ndk | Google Groups

  5. #5
    Registered User
    Join Date
    Jun 2009
    Posts
    24
    Quote Originally Posted by Shakti View Post
    Is it a linker error or a compiler error you are getting?

    this might shed some light on the issue, it is a little dated but might still be relevant:
    Regular expression support in Android - android-ndk | Google Groups
    Thanks Shakti, that is still relevant. It appears to be a linker error as the modules #including regex.h compile. Anyway I'm trying to just incorporate the missing regex code from OpenBSD as suggested in the link you provided.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem using regcomp() regexec()
    By wronski11 in forum C Programming
    Replies: 9
    Last Post: 12-18-2010, 04:21 PM
  2. Sharing a Struct with a Library
    By sjantz0 in forum C Programming
    Replies: 1
    Last Post: 09-13-2010, 07:13 PM
  3. C problem - Create a Personal Library
    By Harliqueen in forum C Programming
    Replies: 33
    Last Post: 04-20-2010, 11:27 PM
  4. how to create an Import Library in Vs2008
    By khumayun in forum C++ Programming
    Replies: 2
    Last Post: 03-19-2010, 10:49 AM
  5. Property Set Library (PSL) - Announcement
    By vultur_gryphus in forum Projects and Job Recruitment
    Replies: 0
    Last Post: 05-29-2008, 06:04 AM