I have a dll for a c++ class (SLABHIDDevice.dll). I am trying to use the functions of this dll in a C#.net application. The dll contains several methods which I can use easily with statements such as this...
(I appolagize if i get some of the terminology wrong here I am new to using dlls)
[DllImport("SLABHIDDevice.dll")]
publi...
I am currently debugging a crashlog. The crash occurs because the vtable pointer of a (c++-) object is 0x1, while the rest of the object seems to be ok as far as I can tell from the crashlog.
The program crashes when it tries to call a virtual method.
My question: Under what circumstances can a vtable pointer become null? Does operator...
Hi,
My program has a main thread that takes command input from a user. Separately, it has potentially multiplie (at least 1) worker threads churning data in the background.
The user is able to terminate the program using a command by typing into the console. However, when the data churning is done, the main thread is still blocking wa...
I am building a lot of auto-generated code, including one particularly large file (~15K lines), using a mingw32 cross compiler on linux. Most files are extremely quick, but this one large file takes an unexpectedly long time (~15 minutes) to compile.
I have tried manipulating various optimization flags to see if they had any effect, wi...
Hello:
I've currently completed one of two phases of a project that required I write database information to XML using C++. While use of a third party tool was used to do the actually formatting of XML tags and data, I still had to design a model along with business logic to take the database tables and map them into XML structures.
F...
I have a questing around such staff.
There is a class A which has a object of type class B as it's member. Since I'd like B to be a base class of group of other classes I need to use pointer or reference to the object, not it's copy, to use virtual methods of B inside A properly. But when I write such code
class B
{public:
B(in...
I'm trying to figure out how could I parse this string using "sstream" and C++
The format of it is: "string,int,int".
I need to be able to assign the first part of the string which contains an IP address to a std::string.
Here is an example of this string:
std::string("127.0.0.1,12,324");
I would then need to obtain
string someSt...
I was told by c-faq that compiler do different things to deal with a[i] while a is an array or a pointer. Here's an example from c-faq:
char a[] = "hello";
char *p = "world";
Given the declarations above, when the compiler sees the expression a[3], it emits code to start at the location ``a'', move three past it, and fetch the ch...
I am trying to work on a homework assignment for school and am going above what the teacher is asking for the assignment -> I have created a "list" class. I keep running into these two errors after adding the 'add()' method to the program - along with the 'newIncomeTax()' methods
error LNK2019: unresolved external symbol "public: voi...
Hi all.
Problem: I have a pretty big structure with POD variables, and I need to copy around some fields, but not others. Too lazy to write down a member-by-member copy function.
Solution: move the copy-able fields to the base, assign the base. Like this:
struct A
{
int a, b, c;
};
struct B : public A
{
int d, e, f;
};
//And ...
is it possible to force a thread to return from a call to a blocking function such as a blocking read from a stream ?
int x;
std::cin >> x;
for example...
...
Hello,
I want to find when a collision between a static and a moving ball occurs, but the algorithm I came up with, sometimes doesn't detect a collision and the moving ball goes through the static one. The moving ball is affected by gravity and the static one is not.
Here's my collision detection code:
GLfloat whenSpheresCollide(const...
I'm trying to re-implement ASP.NET MVC routing rules in C++ for my own MVC application.
Currently the code takes at least O(N) at best case and more if accessing the controller/action inside an unordered_map is not O(1).
I would like my code to prefer a route with a controller that's already in the URI, for instance if the current URI is...
Many years ago, C compilers were not particularly smart. As a workaround K&R invented the register keyword, to hint to the compiler, that maybe it would be a good idea to keep this variable in an internal register. They also made the tertiary operator to help generate better code.
As time passed, the compilers matured. They became v...
Hi All,
Could you let me know about books that explains the ideas of smart pointer very clearly (beginner, intermediate and advanced level)?
Thank you.
...
I have a function which grows an array when trying to add an element if it is full. Which of the execution blocks is better or faster?
I think my second block (commented out) may be wrong, because after doubling my array I then go back and point to the original.
When creating arrays does the compiler look for a contiguous block in memo...
What are inspiring examples of open-source software written in C++ with great tests?
I would like to read, study and follow.
...
Hi,
I'm having trouble applying the visitor pattern for an interpreter in C++. The following code produces (+) rather than ((1+2)+3) as desired:
class ExpVisitor{
public:
virtual void visit(class Add*)=0;
virtual void visit(class Int*)=0;
};
class Exp{
public:
virtual void accept(ExpVisitor *v){};
};
class Add : publ...
#include "stdafx.h"
#include <iostream>
#include <vector>
#include <string>
class Helper
{
public:
Helper() { init(); }
virtual void print() {
int nSize = m_vItems.size();
std::cout << "Size : " << nSize << std::endl;
std::cout << "Items: " << std::endl;
for(int i=0; i<nSize; i++) {
s...
For example:
// This will become either SomeMethodA or SomeMethodW,
// depending on whether _UNICODE is defined.
SomeMethod( _T( "My String Literal" ) );
// Becomes either AnotherMethodA or AnotherMethodW.
AnotherMethod( _TEXT( "My Text" ) );
I've seen both. _T seems to be for brevity and _TEXT for clarity. Is this merely a subjectiv...