I'm trying to learn the basics of tying up unmanaged C++ and .NET. So, I've got the DLL compiled and callable from C#. Great. Now I run into this weird problem:
Here's my C++ file, Main.cpp:
#include <stdio.h>
extern "C" __declspec(dllexport) void DisplayHelloFromDLL()
{
printf ("Hello from the World of 1986!\n");
}
and C# file,...
Is this allowed? :
class A;
void foo()
{
static A();
}
I get signal 11 when I try to do it, but the following works fine:
class A;
void foo()
{
static A a;
}
Thank you.
...
I'm using qt 4.4.3 with c++. I want to implement a QDomDocumentFragment object, and pass it as a return value for a function. I am using it the same way as QDomElement objects, with appendChild():
QDomDocumentFragment rootnode;
QDomNode initmodnode = doc.createElement("initmod");
QDomText initmodval = doc.createTextNode("4");
initmodno...
Well I know there are good topics about smart pointers, but since I'm starting to use them extensively I want to know some recommendations on bad or dangerous uses, e.g:
Raw-pointer conversions
Smart pointers to references/References to smart pointers
etc.
Thank you in advance.
(Added)
Suppose I've a class A with pointers to B as m...
Hi all,
I was recently trying to update my game to store graphics in compressed formats (JPEG and PNG).
Whilst I ended up settling on a different library, my initial attempt was to incorporate ijg to do JPEG decompression. However, I was unable to get even the simplest console application to work and am wondering if anyone might be abl...
Does anyone know why typedefs of class names don't work like class names for the friend declaration?
class A
{
public:
};
class B : public A
{
public:
typedef A SUPERCLASS;
};
typedef A X;
class C
{
public:
friend class A; // OK
friend class X; // fails
friend class B::SUPERCLASS; // fails
};
...
How do I determine whether a function exists within a library, or list out the functions in a compiled library?
...
How do I obtain a stack trace of addresses on Windows without using dbghelp.dll?
I don't need to know what the symbols or function names associated with the addresses, I just want the list of addresses -- something similar to backtrace of *nix systems.
Thanks!
...
I have a template class that is only valid for couple of template parameters:
doIt.h:
// only int and float are valid T
template <typename T>
class doer
{
public:
void doIt();
}
I want to hide the implementation inside the .cpp file (for faster compile and also because its proprietary):
doIt.cpp:
template <>
void doer<T>::doIt()...
I have two simple while loops in my program that I feel ought to be math equations, but I'm struggling to convert them:
float a = someValue;
int b = someOtherValue;
int c = 0;
while (a <= -b / 2) {
c--;
a += b;
}
while (a >= b / 2) {
c++;
a -= b;
}
This code works as-is, but I feel it could be simplified into math equ...
Suppose I have a Linked List I created myself. It has its own destructor, which frees the memory. This Linked List does not overload new or delete.
Now, I'm trying to create an array of said linked lists (open hashing, if I understand correctly). Then I allocate the necessary memory inside the constructor of this open hashing class. The...
I'm currently trying to make a small application that performs different duties. Right now I have a console app pop up and ask what I want to do, but sometimes I would rather just launch it with something like MyApp.exe -printdocuments or some such thing.
Are there any tutorials out there that can show me a simple example of this?
...
We have a .Net application from which a C++ COM component is being instantiated.
We load the COM component from a child form window. There is a common resource that is being edited by the .Net application, which inturn is being used by the COM dll to start up.
When the following sequence of steps are performed:
1. Instantiate COM com...
I've always wondered how to write the "A ? B : C" syntax in a C++ compatible language.
I think it works something like: (Pseudo code)
If A > B
C = A
Else
C = B
Will any veteran C++ programmer please help me out?
...
how can I convert string to double in C++
I want a function that returns 0 when the string is not numerical
...
Hello. I am continue to build two simple processes throwing class objects one to another (see my previous post) through simple (anonymous) pipes. Now I revealed for myself boost::serialization (thanks answered people) and have tried to make some class be serialized through ::WriteFile\::ReadFile. So - what I am doing wrong?
1) I creat...
Hi,
Simple question - In c++, what's the neatest way of getting which of two numbers (u0 and u1) is the smallest positive number? (that's still efficient)
Every way I try it involves big if statements or complicated conditional statements.
Thanks,
Dan
Here's a simple example:
bool lowestPositive(int a, int b, int& result)
{
//ch...
Hey all,
I'm trying to write a program which takes an SDL_Surface, converts it to an IplImage, uses the cvBlobsLib to find blobs, paints the blobs as spots back over the image, then converts the output IplImage back to an SDL_Surface.
I'm almost done: only converting the IplImage back to an SDL_Surface hasn't been done yet. This IplIma...
I`m writing a chat using WinSock2 and WinAPI functions. And I have a little trouble.
I store the std::vector of client connections on server. When new client connects, new thread starts and all work with the client is done in this new thread. I do not use classes (I know it is not very good) so this list of connections is just defined as...
Hi..
I need function in c++ that allows me to retrieve and store the system date. I have a class for storing dates.
...