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).
742
questions
-1
votes
2
answers
97
views
how in #ifdef identifier and #ifndef identifier declare identifiers
#ifdef MATHLIBRARY_EXPORTS
#define MATHLIBRARY_API __declspec(dllexport)
// How to determine the identifier above?
// Where did `MATHLIBRARY_API` came from?
#else
#define MATHLIBRARY_API __declspec(...
0
votes
0
answers
62
views
Deserialize struct using Newtonsoft.Json in Unity, the struct is from an .dll file imported to unity ';Assets' folder
So, basically I have a class library named Shared.dll that build and serialize with newtonsoft.Json, and I want to deserialize the class/struct inside .dll file.
Unity version: 2022.3.f1.
PlayerData....
0
votes
0
answers
34
views
ProcEnv parameter issue from DllExport.MSBuild assembly
I'm currently working on a C# programme developped years ago (ended around 2018) that i have to update. It was developped on VS 2015 but i switched to VS 2022.
DllExport is used to change dll files ...
0
votes
0
answers
15
views
I cannot use my own DLL for another project in Microsoft visual studio
I build my DLL in debug mode, for window x86 system. Here is it's code
#include "pch.h"
#include <windows.h>
#include <iostream>
//I want my client app can use function nhan_2 ...
0
votes
0
answers
54
views
Export and Import viewer for DLL file Using C++
i want to write a program in C++ which takes a dll file and prints the exports and imports of it .
i use loadLibrary function like the code below . but it always go to the first if and return error , ...
0
votes
0
answers
55
views
Why can't a C++ program load a C# DLL? [duplicate]
I write a C# dll to use in C++. But it has some error:
Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime, Version=6.0.0.0, Culture=neutral, ...
1
vote
1
answer
101
views
load dll written in Rust from Excel VBA
I am trying to write dynamic library and use it from Excel.
Now I can call my function from Excel, but it seems that the parameter to the function is passed in a wrong way.
My Rust code looks like ...
0
votes
0
answers
156
views
Using windows dll from python 3.11 and ctypes gives exception: access violation reading 0x00000
I'm facing following situation:
a third party Windows DLL (64bit on my current system) with following signature:
EXPORTS WORD CALLBACK Ixud_DriverInit(WORD *wTotalBoards);
EXPORTS WORD CALLBACK ...
0
votes
0
answers
18
views
Export function in a dll but still use it in other files within the dll project
We are in the process of refactoring some of our code base. At the moment we have many dll's in which most are single C/C++ files. Each of these have a #define in them that allows the compiler to ...
0
votes
0
answers
72
views
Wrap c++ static library (.lib) functions into a DLL - dllexport
I have a static library file (.lib) called SampleArithmetic.lib and the header file for it SampleArithmetic.h. Now using these files, I want to generate a DLL files for the functions present in the ...
0
votes
0
answers
62
views
Having issues exporting symbols from a shared library ( dylib on mac ) which return c++ smart pointer
I am having some questions on how to export functionality between shared libs esp if that shared libs is using managed_pointers and we need to load them up at runtime.
i have two application ...
-1
votes
1
answer
163
views
DllExport from C# .Net application
Is there a simple way of exporting a symbol/constant from .Net 5+ applications without having to install third-party NuGets? I'd like to do something like:
[DllExport("MySymbol")]
public ...
1
vote
0
answers
35
views
How to change hint in export table?
I'm trying to export functions from my DLL, with a custom hint. Currently I am exporting functions with custom symbols and custom ordinal, but I've been unable to change the hint of the exported ...
1
vote
0
answers
45
views
Can anyone help me convert this snippet from C to an x64 .dll?
I'm having trouble converting a .c file to a .dll file with VSCode. I think the problem is that MinGW is not able to compile on x64.
OSError: [WinError 193] %1 is not a valid Win32 application
Any ...
5
votes
1
answer
91
views
When using pointers to structs and using them between C++ and C#, do I need to delete the pointer?
I have a program which uses C# and C++. C++ is used to do low level things such as rendering.
In C# I am making an Input class. It uses GLFW to get the mouse position:
extern "C" __declspec(...
1
vote
1
answer
255
views
how to resolve the warning warning C4251: .... needs to have dll-interface to be used by clients of class 'TestClass'
I create below simple class and build it
class __declspec(dllexport) TestClass
{
private:
std::unique_lock<std::mutex > lock;
public:
void doIt() {
// do something
}
};
but ...
1
vote
1
answer
143
views
How can I define the switch macro that switches between my dllexport and dllimport attribute macros with CMake?
So I have a project (meant to be supported on MacOS, Linux, and Windows) where I am building a shared library and a set of executables linked to that library. In my root CMakeLists.txt I have added:
...
1
vote
0
answers
32
views
How to get rid of boost library exports in final executable
I'm compiling an executable and I use boost libraries inside that executable.
no matter if i use static linking or dynami linking of boost with "BOOST_ALL_DYN_LINK" , my final executable ...
1
vote
0
answers
49
views
Is it possible to nest dll references to avoid requiring access to the original uncompiled code?
I'm trying to import C++ functions from an instrument SDK into LabVIEW, and I'm running into issues with function decorations. I have a header file, the dll, a lib, and a .exp file. Unfortunately, I ...
1
vote
0
answers
138
views
Visual C++ and C# interop
I have the following minimal example:
Suppose we have three libraries:
CoreLibrary (C# .NetFramework library)
ExportLibrary (C# .NetFramework library, but with DllExports library)
CppTests (C++ ...
1
vote
0
answers
78
views
How to port 32-bit DLL definitions to 64-bit?
I have an Application and DLL project that I am trying to port to a 64-bit environment. I ran into an issue with the DLL module definition that would cause linker errors such as the following when ...
0
votes
0
answers
17
views
dllexport does not export explicit function template instantiation definition [duplicate]
I can instantiate and MFC-export a function, but am unable to instantiate a templated function. I need the template to be defined generically so I can instantiate it elsewhere in the translation unit.
...
0
votes
1
answer
87
views
Call a non exported function from a native C++ dll in C#
I am trying to call a non exported function from a native C++ DLL into a C# program.
I have the function signature, which is of type typedef void (_cdecl* TfFunc)(int, unsigned char** data)
The dll is ...
0
votes
0
answers
51
views
Exporting global variable from DLL to Exe
I have a main function in a project which has need to get a variable from dll project in VS2022. It should be initiallized at particular moment in Init function of renderer, that is why I want to ...
0
votes
1
answer
136
views
Calling C# (.NET6) from Ansi C [DllExport]
following example:
public static class DLLExportMethode
{
[DllExport("add", CallingConvention = CallingConvention.StdCall)]
public static int Add(int left, int right)
{
...
1
vote
0
answers
139
views
import C++ dll in C# has different number of parameters [duplicate]
I am trying to import dll that was coded in C++ to C#.
Code in C++:
.h file:
#define DllExport __declspec( dllexport )
extern "C" {
class DllExport SomeClass
{
public:
...
0
votes
0
answers
33
views
Why dllexport-ing a class with a method also exports the a symbol used by that method, even if it's not dllexport-ed itself?
Take a source file like this:
namespace detail {
inline int helper() {
return 1;
}
}
struct __declspec(dllexport) Foo {
int fun() {
return 2*detail::helper();
};
};
Without ...
1
vote
1
answer
331
views
Global initialized variable in a DLL
Is it possible to use a global variable from one DLL module to initialize global variable in other DLL module? If so, how?
I am using Microsoft Visual Studio 17.3.6 and use a C++/CLI wrapper class ...
0
votes
1
answer
84
views
What functions/classes do I have to export from DLLs?
Not a great title, so I will explain it here.
I know I have to export any function or class a client application directly calls. For simplicity, I will refer to them as 'API functions/classes'.
My ...
0
votes
1
answer
110
views
Calling function in C# DLL from Delphi has parameter stuck on single value
I have a C# DLL with several exported functions. On one of these functions, when calling it from our Delphi XE2 application the length parameter for the array is always read as 31 in the DLL, ...
0
votes
1
answer
237
views
Build Pjsip windows sdk/.net 6 target dll
I am trying to create a pjsip dll and add it to an Uwp app. I have built a dll following this (working fine for WPF). Which gives an error while adding dll to the Uwp project saying unsupported-...
0
votes
1
answer
89
views
Error when importing a class/structures from one dll to another dll (c++, lnk2019)
I have 2 DLLs. The first describes the LinkedList data structure. In the second, this structure is used.
LinkedList.h (from first .ddl):
#pragma once
#ifdef DS_EXPORTS
#define DS_LL_API __declspec(...
0
votes
0
answers
667
views
Call native code in flutter via DllExport
Hi I have several code on C# and I want call in on flutter. I add https://github.com/3F/DllExport to my C# project and create .dll. I checked this .dll in other C# project and in works.
My code on C#
...
2
votes
2
answers
240
views
dllexport a type with a std container of std::unique_ptr results in error C2280
I'm trying to dllexport a type with a std container of std::unique_ptr member, f.e.
struct __declspec(dllexport) C {
std::vector<std::unique_ptr<int>> c_;
};
but whatever i try, msvc ...
-2
votes
1
answer
152
views
Cannot call DLL function
I have been trying to call a DLL that simply displays a MessageBox. I am running into issues where the loader will not locate the function. When the program is running, nothing happens. Tried using ...
0
votes
0
answers
30
views
Dynamically Load 2 different DLL's with the same API in c++
I have a C++ application that implements external user written "Apps" as DLLs. My plan to implement this is by loading dlls in a specific directory and starting a new thread for each DLL. ...
2
votes
2
answers
352
views
Undefined reference when creating entry point in shared library clang
I have an issue I don't understand. My project is quite simple for now. I have a shared library Engine which is called by my executable. I'm trying to move the entry point inside my shared library, so ...
0
votes
1
answer
444
views
VS 2022 c# 'type or namespace name 'DllExport' could not be found'
This is from a c# dll from GitHub that is in use by many people so it should compile but this line
[DllExport(CallingConvention.StdCall)]
gives these errors
Error CS0246 The type or namespace name '...
0
votes
1
answer
66
views
C++ Is it safe to change an exported DLL function from int to BOOL?
I'm dealing with a legacy DLL that has may things that started from DOS C code back in the day where there was no concept of a boolean. But the DLL is still in active development and still evolving. ...
0
votes
0
answers
70
views
Error: "ld returned 1 exit status" when building DLL file in C++
I'm just learning how to make a DLL in C++ and I made a DLL and when I try to compile my main Cpp file it gives this error:
id.exe: cannot find -lfactorial
collect2.exe: error: id returned 1 exit ...
0
votes
1
answer
165
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
123
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
170
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
666
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
525
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
67
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
417
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
533
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, ...
0
votes
2
answers
526
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 ...
5
votes
2
answers
283
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....