gcc

Stack issues when calling a DLL compiled with Visual C++ in GCC

I'm trying to call some functions in a DLL compiled with (I believe) Visual C++ from my program, which is compiled using GCC. To call the functions in the DLL, I do a LoadLibrary() on the DLL, and then a GetProcAddress() to get the address of a particular function, which I then call. This function returns a list of pointers to the funct...

Port from gcc 3.3.3 to 4.1.0, C++ templates, undefined reference to

Our application makes use of C++ templates in a number of places. I am currently attempting to port from gcc 3.3.3 to 4.1.0 and am encountering issues. I have recreated the problem in a small shared library and executable. I am building the share library Ok, but the executable fails to link with the following: undefined reference to...

pthreads compile but binary is not created.

I am trying to compile a program I wrote in C++ for an assignment that uses pthreads. I am using Eclipse in Linux, and I didn't have any problems compiling, after I added "-lpthread" to the compiler arguments (to g++, gcc and linker). However, when I was about to run and debug, Eclipse gave me an error message window "Launch failed. Bina...

How to link with static libraries when building an R package...

I'm creating a package that is going to be used by R (the statistical program), I'm not an expert using this application but I have managed to create a very simple package, using the following logic, I have some classes in C++, as the code has to be compiled using the R compiler and it only allows C code, I have a wrapper C code that cal...

Invoking GCC as "cc" versus "gcc"

I am aware that on most GNU/Linux systems, GCC can be invoked by the name "cc" from the command line (as opposed to "gcc"). What I am wondering is if there is any difference in GCC's behavior when it is invoked one way versus the other. For example, I know that invoking GCC through the name "g++" instead of "gcc" causes GCC to behave di...

gcc optimization flags for Xeon?

Hi, I'd want your input which gcc compiler flags to use when optimizing for Xeons? There's no 'xeon' in mtune or march so which is the closest match? ...

Using g++ how can I link with a library that was built using gcc?

I am trying to link a .a library that was built with gcc to a program built using g++. But the name mangling is different. How can I do this? Thanks, CP ...

How to use IDispatch in plain C to call a COM object

I need to compile some code of mine using the gcc compiler included in the R tools (R the statistical program for windows), the problem is that I need to use IDispatch in my code to create an access the methods of a COM object, and the gcc compiler doesn't support much of the code that I'm using to do so, which is basically C++ code. So...

Communicating with ActiveX with a GCC compiler

How do I reference and communciate with an ActiveX library from within my gcc compiled application? ...

Can I configure the VS.NET 2008 IDE to use gcc as a compiler?

Can I configure the VS.NET 2008 IDE to use gcc as a compiler? ...

What does the PIC register (%ebx) do?

I have written a "dangerous" program in C++ that jumps back and forth from one stack frame to another. The goal is to be jump from the lowest level of a call stack to a caller, do something, and then jump back down again, each time skipping all the calls inbetween. I do this by manually changing the stack base address (setting %ebp) and...

How do you check if a pointer, in C, is of a certain type?

How do you check if a pointer is of a certain type? Using sizeof is not sufficient. I am trying to avoid putting id-numbers into my structs to identify their type. The assumption is that maybe gcc puts a struct definition somewhere in the process, and maps the definition to the allocated memory at a pointer. If this is true, I'd think ...

Disable gcc warning for incompatible options.

I'm curious if there is an option to disable gcc warnings about a parameter not being valid for the language being compiled. Ex: cc1: warning: command line option "-Wno-deprecated" is valid for C++/Java/ObjC++ but not for C Our build system passes the warnings we have decided on globally across a build. We have both C/C++ code and t...

How to fetch the end address of my code

Hey, guys - I'm writing a real-time operation system from scratch for a course project. I want to know the end address of my code after I download it to the chip, because I am planning to use the free memory for stack space and I need make sure that I won't overwrite the existing code. I heard about __end variable provided by GCC is th...

Error building pch file with CPP definitions

We're adding CoreData support to our iPhone app. It's a far reaching change (moving from SQLitePersistentObject). To avoid branching, we are running a single codeline with the new code within #ifdef blocks. When I enable this code from one of my headers (#define CORE_DATA_BUILD) everything works fine. When I create a new target and defi...

mapping of a contained struct with boost

Considering these two structs: struct point { int x,y; }; struct pinfo { struct point p; unsigned long flags; }; And a function, that changes a point: void p_map(struct point &p); Is it possible to use boost (e.g. boost::bind or boost::lambda) to create a function equivalent with: void pi_map(struct pinfo &pi) { p_map...

cpp inserts additional space between tokens

I am trying to force gnu - cpp to keep special comments like /*+ ... / because I need them for optimiser hints. It worked well with cpp of xlc (AIX) but now I get an addtional space between slash and plus (/) ? e.g.: $ cat cpp-test.sql #define _STAR * #define OPT_HINT(x) /_STAR+ x _STAR/ select OPT_HINT(INDEX(TABLE table_pk)) * from t...

Selectively disable GCC warnings for only part of a translation unit?

What's the closest GCC equivalent to this MSVC preprocessor code? #pragma warning( push ) // Save the current warning state. #pragma warning( disable : 4723 ) // C4723: potential divide by 0 // Code which would generate warning 4723. #pragma warning( pop ) // Restore warnings to previous s...

What does -fPIC mean when building a shared library?

I know the '-fPIC' option has something to do with resolving addresses and independence between individual modules, but I'm not sure what it really means. Can you explain? ...

Force instantiation of objects with gcc

In the following code, gcc does not instantiate the NSP::Admin and NSP::Server objects. It just skips them. int main(int argc, char **argv) { // Here we boostrap google logging // we also install the signal handler google::InitGoogleLogging(argv[0]); google::InstallFailureSignalHandler(); // now we parse the arguments with gfl...