Questions tagged [declspec]
67 questions
0
votes
0 answers
unresolved external symbol "__declspec(dllimport)"
I'm trying to code a little plugin for bakkesmod because I'm pissing myself off.
I watched the only 2 video that exists on this topic but ... it doesn't work and I have this error for each void - >> Severity Code Description Project File …

LeonimusT
- 1
- 1
0
votes
0 answers
How do i export class that fully defined in header file?
DLL Library:
// export.h
#if defined(COMMON_EXPORT)
#define COMMON_DLL __declspec(dllexport)
#else
#define COMMON_DLL __declspec(dllimport)
#endif
// foo.h
class COMMON_DLL Foo
{
int foo() { return 1; }
}
if i try…

magicDM
- 85
- 5
0
votes
0 answers
c++ LoadLibrary and GetProcAddress from extern DLL
I´ve got an extern DLL to work with. I try to load the DLL with LoadLibrary and get the function by calling GetProcAddress but everytime I debug the programm I got an exception, which I can ignore by windows but in the end my main method throws the…

Felix Arnold
- 839
- 7
- 35
0
votes
1 answer
How to define macro which correctly sets the __declspec
Using Visual Studio 2017, I am trying to build my latest project which imports libraries, which in turn import methods and functions from .dll files.
When building my project, I get a list of errors like this:
error LNK2001: unresolved external…

Jessica Chambers
- 1,246
- 5
- 28
- 56
0
votes
1 answer
Behaviour of delete on novtable base class without a virtual destructor
As I understand it, if you call delete on an interface pointer (or more specifically a base class pointer, pointing to a derived class instance), and that declaration does not have a virtual destructor, then the resulting behaviour is undefined, and…

Kindread
- 926
- 4
- 12
0
votes
0 answers
__declspec(property()) and class declarator
So I've been trying to implement the same type of get and set like in C#. But something generated some doubts about how the variables are declared under the hood in c++. Here's the code:
class foo {
foo Getter() {
return *this;
}
…

Corelli
- 21
- 6
0
votes
1 answer
__thread in Embarcadero c++ 10.1 not creating thread specific variables
In an Embarcadero c++ 10.1 program, I am creating multiple instances of a thread using "new". In each instance, I need thread specific variables containing a pointer and an integer.
I tried two different declarations:
static TProgram_Control…

Enrico Biscotti
- 43
- 4
0
votes
0 answers
Linking errors unless I add __declspec(dllimport)
I am trying to configure a Debug configuration for projects in a Visual Studio solution I inherited. The solution compiles fine in Release. In debug I get a bunch of LNK2019 unresolved external symbol "__declspec(dllimport) ...
The different…

jmlorenzi
- 163
- 5
0
votes
2 answers
__declspec(noinline) on lambda function inside template class throws syntax error in VS2017
While trying to debug an issue with an assert macro I came across this problem. Using __declspec(noinline) on a lambda function in a template class generates a syntax warning in Visual Studio 2017:
error C2760: syntax error: unexpected token…

Fireborn
- 11
- 3
0
votes
0 answers
Can't compile extern C with declspec
Hello I don't know why I can't compile this code ?
#include
#include
using namespace std;
int main()
{
cout << "Hello world!" << endl;
extern "C"
{
__declspec(dllexport) unsigned long NvOptimusEnablement =…

Myranova
- 123
- 1
- 10
0
votes
0 answers
How to export `class static member variable` in windows .dll library using CMake
I am building a C ++ library for Windows, Linux / Unix based on CMake.
I create a shared library(.dll) on Windows, and I want to use a static library(.a) on Linux / Unix.
On Windows, I know how to do __declspec(dllexport/dllimport) for every…

Byeongju Park
- 45
- 9
0
votes
1 answer
Tempate defined by return value of lambda function
Let it be a template with requirement of such behavior:
template
void enumerateChildrenByTag(QDomNodeList& list, const QString& tag, MyActionLambda action )
{
for(int i = 0; i < list.size(); i++) {
QDomElement el…

Swift - Friday Pie
- 12,777
- 2
- 19
- 42
0
votes
1 answer
Is there a way to use __declspec(align) for for declaring of objects with different type
Is there a way to use __declspec(align) for declaring lot of objects in Visual studio? Sth like:
__declspec(align)
{
int p1;
long p2
}
My question is similar to __declspec(align) for multiple declarations. But this question is for objects with same…

Vladimir Yanakiev
- 1,240
- 1
- 16
- 25
0
votes
2 answers
Creating object from class with __declspec(dllexport)
//file.h
# define PartExport __declspec(dllexport)
namespace Part{
class PartExport MyClass : public data::anotherClass{
MyClass();
void read();
};
}
I want to access this function by doing this below. Visual studio suggests to do…

Rasmus
- 65
- 2
- 11
0
votes
0 answers
C++ Visual Studio 2013 Strange error but code runs
I am trying to use __declspec properties and getting some strange errors when using multiple indicies. I get the error:
"expression must be a pointer to a complete object type" in visual studio, but the code seems to run fine. Here is the code I am…

thepenguinmaster
- 515
- 5
- 9