Questions tagged [dllexport]
__declspec(dllexport) is a C and C++ compiler directive, which automates exporting of functions or variables when creating a DLL (Dynamic-link library).
710
questions
0
votes
0
answers
60
views
Can I generate DLL without exporting friend classes
Updated:
I created a project that can 100% reproduce the problem.
1. DLL Project
I named this DLL project TestDLL
The most important codes:
AddC.h:
#pragma once
class CTestDLL;
#include <string&...
0
votes
0
answers
27
views
Using NuGet and ctypes, trying to use c# dll library in python code. Unable to recognize functions
I am using NuGet and ctypes to import a c# dll in my python code so that I can call the c# functions in python. However, for some reason when I try to call the c# functions, they are not recognized. (...
0
votes
1
answer
36
views
How to store text in wchar_t pointer parameter
I want to dll export some functions from cpp to dart and in order to do this I need to create a function with a pointer parameter where I will send text.
But after many searches I found no solution ...
-1
votes
1
answer
82
views
Call function in C++ dll from C# [closed]
I'm trying to call a function in a C++ dll, from C# code.
The C++ function :
#ifdef NT2000
__declspec(dllexport)
#endif
void MyFunction
( long *Code,
...
0
votes
1
answer
53
views
Correct calling convention for exporting windows DLL functions for Excel VBA without mangled names
I am writing a DLL to export functions to be used in Excel VBA - I have found a way to be able to pass parameters in but with mangled names. If I set up without name mangling then I can not pass ...
0
votes
0
answers
25
views
dllexport function from another dll
If I use a program called "DLL Export Viewer" to look at functions exported from the api-ms-win* files in system32 they have exported functions not with an address within the dll itself but ...
1
vote
0
answers
62
views
Passing Json::Value to a function in C++ dll is throwing read access violation exception
I am using JsonCPP library in my C++ project . I created a C++ dll with a function which will take Json::Value as input parameter . I have created another one exe which calls this function by passing ...
-2
votes
1
answer
57
views
How can i export a macro function and use it in a project .exe
I have a dll project (Server.dll) containing a Server.cpp
Server.cpp
#include "pch.h"
#include "Server.hpp"
extern "C" {
_declspec(dllexport) int Server::Add(int a, int b)...
0
votes
2
answers
68
views
Dynamic load a class from a dll in Windows
I want to implement a multiplatform plugin system on an application that I am working, but I am unable to make it work on Windows.
The proposal of this plugin system is to add the posibility of to ...
0
votes
0
answers
22
views
Exporting C++ template class [duplicate]
I'm writing a framework in (hope) modern C++ and since the moment I want to use it in dlls, I wrote a lot of classes which need to be exported.
I managed to export/import them, but now I've arrived at ...
5
votes
2
answers
145
views
Exporting class template with out-of-body definitions from DLL with MinGW-w64
I am facing trouble properly linking a trivial Windows executable to a trivial DLL with MinGW-w64 (based on GCC 11.3.0 from MSYS2) when class templates are involved. A minimal reproducer is as follows....
1
vote
0
answers
39
views
Is it safe to inherit std::exception in an exported DLL?
I'm preparing a DLL lib whose functions / class-methods can throw exceptions. Is it safe to throw instances of classes that inherit std::exception by the DLL-exported methods?
Background
I've been ...
4
votes
1
answer
102
views
using `__declspec(dllexport)` before every public method
I'm working in a C++ workspace in VS2017, having two projects in the workspace: a utility project and a main project that uses the utility project.
After I added a new class (".h" and "....
0
votes
0
answers
19
views
Why do I get run-time error 453 when I try to use a VB.NET dll that uses DllExport?
I created a .NET dll by referencing DllExport provided by https://github.com/3F/DllExport/ in VS 2019. I used the DllExport.bat file to configure my test solution. I call a function/sub from the dll ...
0
votes
0
answers
40
views
Using an object as the parameter of an external function in C#
Let's say I have a timer object in C#:
public class Timer {
private int currentTime;
private int lastTime;
public int GetTimePassed() {
}
}
Is it possible to use this object as a ...
3
votes
1
answer
198
views
C++ function in DLL called through Excel / VBA generates exception when passing double argument
I'm trying to use a C / C++ static function in Excel / VBA through a DLL.
I'm getting an exception when debugging in VS17, and I suspect it's an issue with the way the argument is passed (it's a ...
0
votes
0
answers
37
views
C++ builder dll with delphi modules - not to export classes fields
I'm using Embarcadero C++ builder XE2, and need to make a dll with single function "_tst" (on the top of the screenshot highlighted with red rectangle) in c++ main module. However, as I have ...
0
votes
1
answer
75
views
How can I use C++11 grammar while compiling it with Visual Studio 2019
First of all, It's been 3 months since I started coding, so I might not know what I'm saying.
Feel free to correct me.
I have a question about using some API that is developed in C++11.
I am ...
1
vote
0
answers
149
views
How to properly use cmake to build a cross-platform c++ project that includes pre-compiled third-party libraries
A bit of background: I'm attempting to build a cross-platform C++ project using CMAKE, that I will be able to call from within a dotnet project. I have a large, existing dotnet library that I've ...
0
votes
0
answers
77
views
C++ __imp_ prefix
Although I see it mentioned everywhere that the __imp_ prefix is prepended to symbols for exported functions within a DLL (with the __imp_ version resolving directly into the IAT), I have never found ...
0
votes
1
answer
56
views
How to access constant values in an unmanaged dll
I have an unmanaged dll, inside which there is a constant value as the following:
#define ProtocolVersion 1
How can I access this value in C#?
p.s.: I checked this post but it didn't work.
1
vote
1
answer
237
views
Using UnmanagedExports Package [DllExport] to call C# DLL in VBA Triggers "Can't Find DLL Entry Point" Error
I'm using Robert Giesecke's Unmanaged Exports package to access c# dll in Excel VBA. I've followed several examples and continue to get the run-time error 453: "can't find entry point ...
0
votes
1
answer
260
views
Problems Translating C++ 'extern "C" __declspec(dllexport)' struct to Rust
I am currently attempting to rebuild and update a Project written in Rust (more specifically it's an SKSE64 plugin for Skyrim: https://github.com/lukasaldersley/sse-mod-skyrim-search-se forked from ...
0
votes
1
answer
83
views
Convert VS dll 32 bit to 64 bit causes unresolved external symbol
I wrote a dll in Fortran 90 with Visual Studio 2010 and built for 32bit platforms.
When I call this library from a main program built for 32bit platform it works.
If I built the same dll for 64bit and ...
0
votes
0
answers
93
views
Exporting extern variables from dll visual C++
Basically I have a dll project in visual studio. I'm linking this dll project to a second project successfully but as soon as I try to use extern variables things go wrong. I've seperated my extern ...
2
votes
0
answers
87
views
c++ export with specific address for dll proxy
I would like to create my first proxy dll to intercept and log the calls that a software uses to one of its dlls. My experience in dll export is still limited.
With the help of some online guide, I ...
1
vote
0
answers
272
views
What's the best way to call the Cloud File API from a C# WinRT component?
The Cloud File Api from this Cloud Sync Engine Article is a Win32 Api. I've read that you can call C++ functions in C# using __declspec(dllexport)... and was wondering if that could be done for the ...
0
votes
0
answers
73
views
Why put dllexport after class declaration will eliminate C4251 warning in C++
In MSVC, When I write a class with a std::unordered_map member like below,
class DLLEXPORT TTT
{
std::unordered_map<int, int> _map;
};
a C4251 warning is given:
warning C4251: 'TTT::_map' : ...
0
votes
0
answers
55
views
How to get DLL exported global variable value from it's wrapper?
I have someone's DLL without it's *.lib and I doing the wrapper for it. It has a single global variable exported together with some functions. I know a way to wrap functions, but what to do in case of ...
3
votes
2
answers
178
views
Using a gFortran dll with Excel 365 / VBA 7
For years I used a combination of dlls written in Fortran PowerStation and Excel 02/03, with VBA 6.
But progress marches on, and I got a new machine with Windows 64 bit, Excel 365 (64 bit), and no ...
1
vote
1
answer
84
views
How to configure and export function that should return char array?
I'm trying to create a function that can be called from e.g. Python through a .dll.
I'm working on byte arrays.
This is the original function I'm trying to wrap:
QByteArray getKeys(const QByteArray ...
0
votes
0
answers
72
views
Linkage of static variables in member functions defined in-class
//lib.h
#pragma once
#ifdef _MSC_VER
#ifdef BUILD_LIB
#define LIB_API __declspec(dllexport)
#else
#define LIB_API __declspec(dllimport) /* here */
#endif
#else
#define LIB_API
#endif
void LIB_API ...
0
votes
0
answers
28
views
How to call c++ method with parameter by python
I have a file named trade.dll compile by my friend. And I can call it by c++ with main.cpp
main.cpp
HMODULE HMODULE1 = LoadLibrary("trade.dll");
...
0
votes
1
answer
89
views
How to marshal nested array from C# to C++?
I am making a DLL in C++ to use in C#. I need to transfer a array list from C# to C++ vector. The array will look like
[][]
[][]
.
.
I referred to this answer for marshaling List to vector link.
It ...
4
votes
2
answers
134
views
Calling RANDOM_NUMBER in a Fortran DLL
I want to compile and link a dynamic link library (dll) from a Fortran code using gfortran (mingw - 64bit) in windows. I test generated dlls in Excel 64-bit. I noticed, Excel does not return any ...
0
votes
1
answer
68
views
Virtual destructor makes it necessary to export the interface on VS2017
I have a C++ interface, let's call it IX with a few methods:
class IX
{
public:
virtual void foo() = 0;
virtual void bar() = 0;
}
this interface is located inside a library (dll), but ...
0
votes
0
answers
24
views
Is it possible to dllexport a method that has been made accessible through the using-declaration?
In my application, I derived a class privately from a base class, but still want to make a few of the base class methods accessible, which can be achieved through the using-Declaration. Now I would ...
0
votes
0
answers
316
views
Is __declspec(dllexport) ignored if compiling a static library?
Currently I am taking an older static library I wrote, and trying to add functionality to allow it to be compiled as a .dll, (or .so). I've gone through and added a macro along the lines of:
#define ...
2
votes
1
answer
207
views
DLL export __stdcall without DEF file and decorated function names with VS
If I have a DLL file...how can I see functions are built as __stdcall or __cdecl?
I want to create a DLL to export functions as __stdcall without DEF file and decorated function names with Visual ...
0
votes
1
answer
115
views
How to link third party library into my project in visual studio?
I am trying to import C++ third party library:
1- FKAttend.h
2- FKAttend.lib
3- FKAttend.dll
In header file it uses implicit linking to call the functions
#ifdef _FKATTEND
#define FP_EXPORT ...
0
votes
1
answer
126
views
Incomplete type error while using class from my own dll
One more day, one more dumb question on stackoverflow, please excuse me.
The idea was to make dll and then import it to another project to use it there, but after including dll header file in second ...
0
votes
2
answers
141
views
How to dll import and export HINSTANCE from a .dll in c++?
I am trying to get the HINSTANCE of a .dll, but I get this error:
error LNK2019: unresolved external symbol "__declspec(dllimport) struct HINSTANCE__ * m_instance" (__imp_?m_instance@@...
0
votes
0
answers
61
views
About program export variables
The graphics card manufacturer has an optimization scheme. The following variables are exported from the program, and the program will be executed with an independent graphics card. For the program ...
-2
votes
1
answer
204
views
Loading dll at runtime
I need to load a DLL at runtime. I don't know in advance which DLL to load, but DLLs are the implementation of an interface (pure virtual method). The final goal is to have a pointer to a DLL to call ...
0
votes
0
answers
41
views
C++ CppUnitTest changes DLL-Layout
I'm working on a C++ application with a vast amount of DLLs. Now I am trying to Unit test them with the Microsoft Visual Studio C++ Test Framework. I need to unit test the internal logic, as the DLL ...
0
votes
0
answers
524
views
Error "linkage specification is not allowed" when using extern "C" with __declspec(dllexport) in a C++ class
When I am using using extern "C" with __declspec(dllexport) in the Class, then I am getting an error "linkage specification is not allowed".
If i declare this outside of the class ...
0
votes
0
answers
105
views
PROJECTNAME_EXPORT macro doesn't work in Visual Studio 2019 in DLL Project
I create a DLL project.
Visual Studio 2019 doesn't define the MACRO HAZEL_EXPORTS (<ProjectName>_EXPORTS ). So I can't export/import my symbols.
Any Help?
Here is my code:
#pragma once
// test....
1
vote
1
answer
79
views
Can't handle exceptions when invoking C# function from unmanaged C++ code
The idea of issue is following: I'm passing C# function pointer to C++ compiled library then from C++ invoke passed function. I want to catch C#/C++ exceptions from code, which lays before C++ ...
0
votes
0
answers
937
views
Previous IPDB not found, fall back to full compilation
The project structure is: dynamic library project.
I try to generate a DLL.file based on a completed C++ project, and expect to compile it in MATLAB. After the Rebuid solution, the output reminds me '...
0
votes
2
answers
123
views
static variables duplicate in defined template class usage from DLL
i have the following code in a DLL, in a header file called TemplateT:
#pragma once
template<class T>
class __declspec(dllexport) TemplateT {
public:
static int number;
TemplateT(int ...