I have the following C code:
const BYTE* Items[3];
Items[0] = item1;
Items[1] = item2;
Items[2] = item3;
int result = Generalize(3, Items);
with Generalize having a signature of
int __stdcall Generalize(INT count, const BYTE * const * items);
What is the best way to make that call with PInvoke?
...
I need to be able to invoke arbitrary C# functions from C++. http://www.infoq.com/articles/in-process-java-net-integration suggests using ICLRRuntimeHost::ExecuteInDefaultAppDomain() but this only allows me to invoke methods having this format: int method(string arg)
What is the best way to invoke arbitrary C# functions?
...
Is it possible to make a C++ header file (.h) that declares a class, and its public methods, but does not define the private members in that class? I found a few pages that say you should declare the class and all its members in the header file, then define the methods separately in you cpp file. I ask because I want to have a class th...
Hi Guys,
I was passing a test and met a question in which we didn't find an agreement with my colleagues.
С++
1 class Base {};
2 class Derived : public Base {};
3 class Foo
4 {
5 public:
6 Foo()
7 {
-8- Base* b = new Derived(); // Concept name is?
9 }
10 };
C#
1 abstract class Base{}
2 publi...
I am developing a multi-platform application and in one component I have a class method called DrawText. Unfortunately, I get a linker error (on windows only) saying that there is an unresolved external symbol for a DrawTextW method of this class.
I've seen this before with other methods ending in "Text" where it is looking for either a...
I've written recursive functions with the guidance of a friend who is teaching me C++ (as a first language). However, I don't really understand what is going on. He helped me (and the SO community, as well) write a merge sort function.
std::vector<int> mergeSort(std::vector<int> original)
//code here to create two vectors, farray and s...
I'd like to study some good c/c++ code. The code should:
be good in style and structure, presenting best practices
be a real life program (not an example or toy)
not too big so it doesn't takes ages to analyse it
Windows and/or Unix
I know there are 1000s of open source projects out there. But I'd like to hear your suggestions.
...
I have my dad's old PC from the 1980's. It's a Tandy 1000 PC SX:
This computer doesn't have a modem, but I have another PC that has Windows XP on it and it also has a 5 3/4 inch floppy drive. So where can I find a C/C++ compiler for this old PC? If you don't help me I'll be forced to program in GW-BASIC.
...
Hello Stackoverflow,
I want to create a web application that runs with very little RAM and I think C++ can help me achieve that.
Now, many people say C++ is unsuited for web development because:
there is no easy string manipulation
is an unsafe language (overflows, etc)
long change/build/test cycles
etc
But I'm sure the C++ commu...
I've used both CppUnit and boost::test for C++ unittesting. Generally I prefer boost::test, mainly because the auto-test macros minimise the effort to setup tests. But there's one thing I really miss from CppUnit: the ability to register your own "protectors", instances of which automatically wrap all the run tests. (Technically, you ...
Is there a way in C++ where an objects has argument added upon it, with an array such as:
int x = 1;
int y = 2;
Object myObject( x, y )[5]; // does not work
I was hoping that I could put arguments into the object, while creating an array of 5 of these objects, does anyone know how? and is there a bteter way?
...
I have a class containing a number of double values. This is stored in a vector where the indices for the classes are important (they are referenced from elsewhere). The class looks something like this:
Vector of classes
class A
{
double count;
double val;
double sumA;
double sumB;
vector<double> sumVectorC;
vector<double>...
Cound anybody recommend me a good book about managed c++?
I found some but I'm not sure which one is the best..
thanks
...
I feel I'm a well rounded programmer, I'm comfortable in C# and java (several large projects with both) but I tend to use C++ for most applications when I have a choice. (and sometimes R,Python, or Perl as appropriate..)
But I am astounded to see the popularity of C# here on SO. There are 18500 C# topics, more than C, C++, and java comb...
Assume:
A. C++ under WIN32.
B. A properly aligned volatile integer incremented and decremented using InterlockedIncrement() and InterlockedDecrement().
__declspec (align(8)) volatile LONG _ServerState = 0;
If I want to simply read _ServerState, do I need to read the variable via an InterlockedXXX function?
For instance, I have seen...
I noticed some not so old VM languages like Lua, NekoVM, and Potion written in C.
It looked like they were reimplementing many C++ features.
Is there a benefit to writing them in C rather than C++?
...
I'm working with UDP sockets in C++ for the first time, and I'm not sure I understand how they work. I know that sendto/recvfrom and send/recv normally return the number of bytes actually sent or received. I've heard this value can be arbitrarily small (but at least 1), and depends on how much data is in the socket's buffer (when reading...
I am working on the bootstrap application of an installer, and I have a dialogue that the user can open to select a different target directory from the given default. Currently, I'm using the CFolderDialog for that, but for the user to select a folder that doesn't yet exist, he has to create the folder first. Once the user has specified ...
I am wondering if there is a cross-platform allocator that is one step lower than malloc/free.
For example, I want something that would simply call sbrk in Linux and VirtualAlloc in Windows (There might be two more similar syscalls, but its just an example).
...
Hello.
I have some questions about initializing a static collection. Here is an example I coded that seems to work:
#include <stack>
#include <iostream>
using namespace std;
class A
{
private:
static stack<int> numbers;
static stack<int> initializeNumbers();
public:
A();
};
A::A() { cout << numbers.top() <<...