c++

Open source PDF library for C/C++ application?

I want to be able to generate PDF ouput from my (native) C++ Windows application. Are there any free/open source libraries available to do this? I looked at the answers to this question, but they mostly relate to .Net. ...

Precompiled headers with GCC

Anyone had any success getting precompiled headers working with GCC? I have had no luck in my attempts and I haven't seen many good examples for how to set it up. I've tried on cygwin gcc 3.4.4 and using 4.0 on Ubuntu. ...

Programmatically change combobox

I need to update a combobox with a new value so it changes the reflected text in it. The cleanest way to do this is after the combobox has been initialised and with a message. So I am trying to craft a postmessage to the hwnd that contains the combobox. So if I want to send a message to it, changing the currently selected item to the n...

Visibility of template specialization of C++ function

Suppose I have fileA.h which declares a class classA with template function SomeFunc<T>(). This function is implemented directly in the header file (as is usual for template functions). Now I add a specialized implementation of SomeFunc() (like for SomeFunc<int>()) in fileA.C (ie. not in the header file). If I now call SomeFunc<int>() f...

App does not run with VS 2008 SP1 DLLs, previous version works with RTM versions

Since our switch from Visual Studio 6 to Visual Studio 2008, we've been using the MFC90.dll and msvc[pr]90.dlls along with the manifest files in a private side-by-side configuration so as to not worry about versions or installing them to the system. Pre-SP1, this was working fine (and still works fine on our developer machines). Now tha...

C++ inheritance and member function pointers

In C++, can member function pointers be used to point to derived (or even base) class members? EDIT: Perhaps an example will help. Suppose we have a hierarchy of three classes X, Y, Z in order of inheritance. Y therefore has a base class X and a derived class Z. Now we can define a member function pointer p for class Y. This is writ...

C++ Quiz - Singletons

I'll soon be posting an article on my blog, but I'd like to verify I haven't missed anything first. Find an example I've missed, and I'll cite you on my post... The topic is failed Singleton implementations - in what cases can you accidentally get multiple instances of a singleton? So far, I've come up with Race Condition on first ca...

IDebugProgramProvider2.GetProviderProcessData on Vista

As part of a JavaScript Profiler for IE 6/7 I needed to load a custom debugger that I created into IE. I got this working fine on XP, but couldn't get it working on Vista (full story here: http://damianblog.com/2008/09/09/tracejs-v2-rip/). The call to GetProviderProcessData is failing on Vista. Anyone have any suggestions? Thanks, ...

C++ function pointers and classes

ok say I have void Render(void(*Call)()) { D3dDevice->BeginScene(); Call(); D3dDevice->EndScene(); D3dDevice->Present(0,0,0,0); } This is fine as long as the function I want to use to render is a function or static class method Render(MainMenuRender); Render(MainMenu::Render); However I really want to be able to use...

Why should the "PIMPL" idiom be used?

Backgrounder: The PIMPL Idiom is a technique for implementation hiding in which a public class wraps a structure or class that cannot be seen outside the library the public class is part of. This hides internal implementation details and data from the user of the library. When implementing the this idiom why would you place the public...

How to replace WinAPI functions calls in the MS VC++ project with my own implementation (name and parametrs set are the same)?

I need to replace all WinAPI calls of the CreateFile, ReadFile, SetFilePointer, CloseHandle with my own implementation (which use low-level file reading via Bluetooth). The code, where functions will be replaced, is Video File Player and it already works with the regular hdd files. It is also needed, that Video Player still can p...

cross platform IPC

Hi, I'm looking for suggestions on possible IPC mechanisms that are: cross platform (WIN32 and Linux at least) Simple to implement in C++ as well as the most common scripting languages (perl, ruby python etc). Finally, simple to use from a programming point of view! What are my options? I'm programming under Linux, but I'd like what...

Is Global Memory Initialized in C++

And if so, how? (Second) Clarification: When a program starts up, what is in the memory space which will become global memory, prior to primitives being initialized. I'm trying to understand if it is zeroed out, or garbage for example. The situation is can a singleton reference be set - via an instance() call, prior to its initializa...

Guidelines to improve your code

What guidelines do you follow to improve the general quality of your code? Many people have rules about how to write C++ code that (supposedly) make it harder to make mistakes. I've seen people insist that every if statement is followed by a brace block ({...}). I'm interested in what guidelines other people follow, and the reasons behi...

c++ Having multiple graphics options

Currently my app uses just Direct3D9 for graphics, however in the future I' m planning to extend this to D3D10 and possibly OpenGL. The question is how can I do this in a tidy way? At present there are various Render methods in my code void Render(boost::function<void()> &Call) { D3dDevice->BeginScene(); Call(); D3dDevice->...

What is wrong with using inline functions?

While it would be very convenient to use inline functions at some situations, Are there any drawbacks with inline functions? Conclusion: Apparently, There is nothing wrong with using inline functions. But it is worth noting the following points! Overuse of inlining can actually make programs slower. Depending on a function's size, ...

How to solve Memory Fragmentation

We've occasionally been getting problems whereby our long-running server processes (running on Windows Server 2003) have thrown an exception due to a memory allocation failure. Our suspicion is these allocations are failing due to memory fragmentation. Therefore, we've been looking at some alternative memory allocation mechanisms that ...

Resetting detection of source file changes

I sometimes have to work on code that involves me moving my clock ahead forward. In this case some .cpp or .h files get their last modification date updated to the future time as I work on them. Later when my clock is fixed, and I go to compile, it requires a rebuild of most of the project because some of the last modification dates ar...

How do I disassemble a VC++ application?

I believe the application has some parts that target .NET, and some that don't. I'm particularly interested in looking at the resource files, if there are any. ...

What to Learn after C++?

I have been learning C++ for a while now, I find it very powerful. But, the problem is the the level of abstraction is not much and I have to do memory management myself. What are the languages that I can use which uses a higher level of abstraction. ...