I'm trying to create a DLL that exports a function called "GetName". I'd like other code to be able to call this function without having to know the mangled function name.
My header file looks like this:
#ifdef __cplusplus
#define EXPORT extern "C" __declspec (dllexport)
#else
#define EXPORT __declspec (dllexport)
#endif
EXPORT TCHA...
Hopefully this is a brainlessly easy question, but it shows my lack of expertise with C++. I'm a C# programmer, and I've done extensive work with P/Invoke in the past with other people's C++/C dlls. However, this time I've decided to write a wrapper C++ dll (unmanaged) myself, and am then calling my wrapper dll from C#.
The problem I ...
I have a debug condition to manage memory where I have
extern void* operator new(unsigned int size, const char* file, int line);
extern void operator delete(void* address, const char* file, int line);
extern void Delete(void* address);
#define FUN_NEW new(__FILE__, __LINE__)
#define FUN_DELETE delete
This exists in...
I am using __declspec(dllimport/export) on a debug version of new as such:
#ifdef _DEBUG
DECLSPECCORE extern void* operator new(unsigned int size, const char* file, int line);
extern void* operator new[](unsigned int size, const char* file, int line);
extern void operator delete(void* address, const char* file, int line);
extern v...
For natural sorting in my application I currently P/Invoke a function called StrCmpLogicalW in shlwapi.dll. I was thinking about trying to run my application under Mono, but then of course I can't have this P/Invoke stuff (as far as I know anyways).
Is it possible to see the implementation of that method somewhere, or is there a good, c...
I have a C-Wrapper for my C++ Framework. Since this should run on mac and windows I am using scons:
env = Environment()
env.Append(CPPPATH = ['./'])
env.Append(LIBS = 'kernel32.lib')
env.Append(LIBPATH = 'C:/Program Files/Microsoft SDKs/Windows/v6.0A/Lib')
env.SharedLibrary(target='warpLib', source='warplib.cpp')
Simple Versions of w...
Hi, I have created two files:
tunables.h
#ifndef TUNABLES_H
#define TUNABLES_H
void tunables_load_conservative();
void tunables_load_aggressive();
extern int timer_x;
#endif /*TUNABLES_H */
and tunables.c
#include "tunables.h"
int timer_x;
void tunables_load_conservative(){
timer_x = 3;
}
void tunables_load_aggressive(){
...
How does the following example usage of extern specifer behave.
We have a global variable int x both in files one.c and two.c
We want to use these in three.c so have declared this variable in three.c as
extern int x;
What would happen when we compile and link these files?
My answer is: compilation of all these files should succe...
I'm reading some code that goes:
extern class MyClass : BaseClass
{
...
} MyInstance;
Does the extern refer to the class declaration or the instance?
...
Can I mix extern and const, as extern const? If yes, does the const qualifier impose it's reign only within the scope it's declared in or should it exactly match the declaration of the translational unit it's declared in? I.e. can I declare say extern const int i; even when the actual i is not a const and vice versa?
...
Using VC8, I create two modules similar to the following:
Header
class IFoo
{
virtual void Bar() = 0;
};
Module A
extern IFoo& Foo;
void DoStuff()
{
Foo.Bar();
}
Module B
IFoo& Foo = ConcreteFoo();
VC8 handles this by essentially treating 'Foo' as a pointer to an IFoo. Wherever it sees Foo.Bar() (even in module B), it...
I’m using a pair of global variables in one of my .c files, matched to a single extern declaration each in two different .h files (well, one .h file, preprocessed two ways). One is for public consumption, and one is for private use. Both are const variables.
I only want to initialize one of the variables in my .c file, and then assign t...
I am new to iphone development.I want to access a variable declared in one view in another view.How can i achieve it.Whether it is possible by using extern variable, if so how to declare and implement it.Can i achieve it by using delegates?then so how to implement it.Please guide me.I am browsing google to get and idea to achieve it, i ...
I'm working on getting rLog to build as a DLL under windows, and I was getting undefined symbol errors relating to some global symbols in the rlog namespace. Specifically these in RLogChannel.cpp:
namespace rlog {
...
RLogChannel *_RLDebugChannel = GetGlobalChannel( "debug", Log_Debug );
RLogChannel *_RLInfoChannel = GetGlob...
How this works in C or C++?
extern "C" {
#include <unistd.h>
#include <fd_config.h>
#include <ut_trace.h>
#include <sys/stat.h>
#include <sys/types.h>
}
...
AFAIK, extern keyword should be used for declaration and no value can be associated with the variable being declared with extern keyword. But supposing I write a statement like
extern int i = 10;
Should the compiler flag an error for the same? I have seen some compilers being tolerant and ignoring this? Why is this so? What does the '...
Solution:
This is an interesting problem, because sometimes we have no choice but to declare an explicitly qualified name.
std::string convert();
namespace tools {
class Numeric {
// ...
// parsed as: "friend std::string::convert ();"
// (actual name is missing!).
friend std::string ::convert();
};
}
In that c...
I'm taking a programming languages course and we're talking about the "extern C" declaration.
How does this declaration work at a deeper level other than "it interfaces C and C++"? How does this affect the bindings that take place in the program as well?
...
I manage project for JNI for both compilers: MSVC++ 8.0 and 9.0,
my cpp file contains following implementation:
extern "C" {
JNIEXPORT jlong JNICALL Java_context_ServiceProviderContext_StartServiceProvider
(JNIEnv * env, jclass, jstring jspath){
.....
}
With help of depends.exe utility I can see that MSVC 8.0 successfu...
Hello,
I'm trying to write/read to an extern device connected to a FTDIchip FT2232 MPSSE mode using SPI. I'm using the SPI function given by FTDI for Labview. I'm doing this:
Open_Device - Init_Device - Write/Read - Close_Device
The problem is that I don't have a clock signal on the scope when I try to read/write.
Do you have a solut...