gnu

Windows port/implementation for GNU Pth (Gnu Portable Threads)

I have inherited a pure C project that uses GNU Pth ( http://www.gnu.org/software/pth/ ) and I was hoping that there was a Windows port/implementation so I wouldn't have to stick a whole bunch (more) conditionals into my code. I know I am being hopeful, but is there anything that provides the exact same function signatures and functiona...

Any caveats in porting GNU Pth code for Pthreads?

I have code written using GNU Pth ( http://www.gnu.org/software/pth/ ) and I want to move to Pthreads because I want it to be cross-platform (Unix, Mac, Windows). Are there and caveats I should watch out for while going about switching from Pth to Pthreads, or is it mostly just a matter of realigning arguments and variable types? ...

C++ undefined reference when linking

Im wondering if anyone would be able to help me as I have been scratching my head for two days on this. I have done the compilation and when trying to link a source code on linux getting undefined reference Compiling using, g++ -g -I/u01/kasunt/workspace/corelibCORBA/include -I/u01/kasunt/workspace/corelibCORBA/installed_compo...

Using getrusage

Hello Everyone! As a continuation of this question I'm wondering if I can get some simple sample code as to how to make use of getrusage. I would like to use it to find the time CPU used by a process, ideally from the PID. I'm working in Cocoa, Objective_C and of course C. Any help would be awesome! Thanks ...

C++ -fvisibility=hidden -fvisibility-inlines-hidden

I have a question about the C++ visibility attribute. I have read http://gcc.gnu.org/wiki/Visibility and yet I dont quite understand how it works. I want use the visibility to be hidden on some of my shared libraries I have. I believe this means that the symbols are hidden ? How are you meant to link the shared library then ? Is there ...

Regular Expression for detecting repeated substrings is SLOW

I am trying to come up with a GNU extended regular expression that detects repeated substrings in a string of ascii-encoded bits. I have an expression that works -- sort of. The problem is that it executes really slowly when given a string that could have many solutions The expression ([01]+)(\1)+ compiles quickly, but takes about...

Find long filenames using GNU find -regex

Hi I'm trying to find all long filenames in a directory using: find . -regex './[^/]\{5,\}.txt' According to the GNU find documentation, -regex uses emacs regex by default. So this should give me all files longer than 5 characters (excluding extension). Unfortunately it does not work. It matches nothing. I've tried various variation...

Questions about the GNU linker editor "ld" ?

I have 2 obj files assembled with GNU as, they are: a.o : my major program b.o : some utility functions a.o doesn't have an entry point. The final linked file will be loaded into memory and the execution will jump to its very beginning loaded address, where is the first instrucion of a.o. Now I want to link them together with GNU ld...

Learning GNU GCC compiler optimization implementation

I would like to understand how the GNU GCC compiler handles optimizations. I know its not easy but I can't seem to find any GCC internal implementation details even just to get started. Do I have to be a contributing GNU GCC developer to view the source code and know the low/high level design? Where can a developer, who wants to contri...

performance of visual studio vs gnu C++ compiler

I calculated time elapsed in my function in VS and g++. I see a huge performance difference. I use unix time command to calculate time elapsed from my g++ compiled executable. I use clock function in main() to calculate time elapsed in VS. g++ is giving ~2 seconds whereas VS is giving 19 seconds which is a huge difference. Can this be ex...

C++ performance issue

Hi all, I am having a little dilemma with a C++ code. Its actually a performance issue. I am trying to traverse through two hash_maps which is causing a lot of slowness. Heres the hash map class code. Let me know if I am missing something from this. template<class Handle, class Object, class HashFunc, vector<Object *> (*initFunc)()> ...

Changing directory echoes "Directory: <pwd>"

Hi, I have an annoying problem when using Screen on my SLED10 machine. When changing directory (cd, chdir, pushd/popd) the resulting path is echoed in the terminal. user@/home/user> cd .. Directory: /home user@/home> This problem only seem to exist in Screen. I have checked my prompt and it does not contain anything related to this ...

How do I properly reference the GNU readline library to scan terminal input?

I am attempting to compile C code that utilizes the following within GNU readline. #include <readline/readline.h>; #include <readline/history.h>; I've tried changing the <> to "" and compiling both with and without the -lreadline options. Nothing seems to work. When compiling without -lreadline under gcc results in the following being...

C: fscanf and character/string size

Hello. I am parsing a text (css) file using fscanf. The basic goal is simple; I want to pull out anything that matches this pattern: @import "some/file/somewhere.css"; So I'm using fscanf, telling it to read and discard everything up to a '@' character and then store everything until it reaches a ';' character. Here's the function that...

Make GNU screen survive reboot

I am using GNU screen a lot. I find it very annoying that everytime the server has to be rebooted I lose all my sessions (even if I know in advance, I need to set-up everything again). I've searched the web for possibilities how to make screen survive a reboot, but found nothing that works for me. Some of the methods I found and there f...

Question on wget

Can wget be used to get all the files on a server.Suppose if this is the directory structure using Django framework on my site foo.com And if this is the directory structure /web/project1 /web/project2 /web/project3 /web/project4 /web/templates Without knowing the name of d...

Anyone know how malloc_info() works?

Hi, I've been trying to figure out how the malloc_info() function located in malloc.h works. I know you have to pass it a FILE* and that no options are implemented yet, but I am at a loss as to what it is actually reporting!? Furthermore i've written a test app that allocates a whole bunch of memory and the values reported from malloc_i...

gdb print inconsistency

I have some code int main(int argc, char* key[] ) { cout << strlen(key[1]) << endl; cout show 4. now using gdb (gdb)print strlen(key[1]) shows -147660784 What is the reason for this difference? ...

GNU diff3 (three-way merge) gives unexpected result

Assume that files MINE and YOURS are descendants of OLD. FILE_MINE= abc def ghi FILE_OLD= abc jkl ghi FILE_YOURS= abc def ghi Command diff3 -m MIND OLD YOURS gives: abc <<<<<<< OLD jkl ======= def >>>>>>> YOURS ghi diff3 cannot resolve that MINE and YOURS made identical changes. Why? And, is there a way to resolve this...

Is there a glibc hash function?

Hey, I'm looking to do a custom hash table implementation in C. Is there an MD5/SHA1 hash function already in the GNU library or do I have to use an external library for this? Here's kinda what I'm looking for: int hashValue; hashValue = MD5_HASH(valToHash); ...