DllExport | NET DllExport with .NET Core support
kandi X-RAY | DllExport Summary
kandi X-RAY | DllExport Summary
.NET DllExport with .NET Core support (aka 3F/DllExport aka DllExport.bat)
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of DllExport
DllExport Key Features
DllExport Examples and Code Snippets
Community Discussions
Trending Discussions on DllExport
QUESTION
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 ".cpp" files) to the utility project, I noticed that although I make changes in the code, the ".lib" file is not rewritten when I build it, unless I change a method whose declaration includes __declspec(dllexport)
. It appears that I have to add this declaration, since otherwise, a derived issue is that of course the main project has linkage errors.
Is there a more elegant way to do it rather than adding __declspec(dllexport)
before the declaration of every public method, like in the code below?
ANSWER
Answered 2022-Apr-12 at 09:15You can add the declaration to the class, instead of to the individual methods:
QUESTION
In some documents, I learned that we shall use 'restrict' to decorate function parameters or memory allocation statements. Like this:
...ANSWER
Answered 2022-Mar-17 at 08:03This usage of restrict
doesn't make much sense. The keyword only serves a purpose when you have two or more pointers to compatible types and the compiler can't know if they potentially point at the same object. Or if they possibly point to an object with external linkage ("global") in the same translation unit. More details here.
In funcA
the pointer has no relation to any other pointer or object in the program, since it is assigned to dynamic memory inside the function. restrict
fills no obvious purpose at all in that function.
QUESTION
I was going to call an unmanaged function in a c++ library from c#, but it crashed. While troubleshooting I narrowed it down to std::wstring. A minimal example looks like this:
C++
...ANSWER
Answered 2022-Mar-11 at 19:36This is something I noticed:
QUESTION
I have a VS solution with an executable and a DLL.
In the executable (MAIN):
...ANSWER
Answered 2022-Mar-01 at 10:06Don't export functions from EXEs. Export a function from the DLL that accepts a function pointer as input, then have the EXE call that function at runtime.
EXE:
QUESTION
In my example code:
main.cpp
...ANSWER
Answered 2022-Jan-30 at 05:53Your approach is correct but your program contains some undefined symbols which need to be imported from libstdc++
at startup (e.g. std::cout
). Linker has to insert such symbols in your library's symbol table, otherwise loader won't know that they need to be imported.
You can link against static version of STL (via -static-libstdc++
) and apply a version script to prevent linker from exporting STL symbols from your shared library:
QUESTION
I am able to return a string after it is converted to a char*
.
ANSWER
Answered 2022-Jan-01 at 22:04The function is returning a char**
, and you've told Python that it is returning a char*[3]
(an array of 3 char*
pointers, not a pointer itself), so the returned value isn't being interpreted properly by ctypes.
Change the return type to ctypes.POINTER(ctypes.c_char_p)
, or alternatively change your program to return something that has the same size as char*[3]
, like std::array
or struct otp_data { char *one, *two, *three; };
(which would be 1 less malloc since you can return this by value)
QUESTION
Update (1): The same problem can be seen with some compiled stdlib modules. This is not related to numpy (I'm removing the numpy tag and numpy from the title)
I'm writing a shared object (that is a plugin for a software) that contains an embedded python interpreter. The shared object launches an interpreter and the interpreter imports a python module to be executed. If the imported module includes numpy, I get an undefined symbol error. The actual undefined symbol error changes in function of the python version or numpy version, but it is always a struct of the PyExc_*
family.
I've simplified the issue to this mimimum example (it comprises actually two files):
...ANSWER
Answered 2021-Dec-17 at 09:08I've found a solution. Knowing that it was not tied to numpy halped quite a lot to switch the focus on the real problem: symbol missing. Taking the suggestion from this answer and in particular this point:
Solve a problem. Load the library found in step 1 by dlopen first (use RTLD_GLOBAL there as well).
I've modified the minimum example as follows:
QUESTION
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 MyDLLFunction in myDllName.dll"
I'm on a 64bit machine using 64bit Excel and am packaging the dll for x64.
I'm working in Visual Studio 2022 and have tried preparing the dll in both .NET 6.0 and .Net Framework 4.7.2.
Here's my exported class:
...ANSWER
Answered 2021-Dec-17 at 01:26I believe it's fixed. I'm finally able to see exported functions in the dumpbin /exports output. There were several things that I believe needed to be done to correct the problem. Hope this helps someone in the future.
Packaged is Not Updated - Try Older Version of VS
Based on the age of the package I suspected it wasn't cooperating in VS2022 so, I:
- Created the project in Visual Studio 2015 (vs VS2022 which I was using)
- Rebuilt project from scratch and added references to new project rather than trying to open old project in VS2015
DllExportAppDomainIsolatedTask Error
Then, the project wouldn't build, it kept throwing the error:
The "DllExportAppDomainIsolatedTask" task failed unexpectedly.
Based on this answer I:
- Installed Microsoft Build Tools for VS2015
- Installed .NET 3.5 and manually added Microsoft.Build.Tasks.v3.5 as a reference to my project by browsing to its location after the .NET3.5 install
But I kept receiving the same error. I then increased the debug output by changing the setting: Project>Properties>Build>Errors and Warnings>Warning Level to 4.
Digging through the debug log I found several lines from the UnmanagedExports package which referenced the project platform, framework path, library tools path, tools dll path, etc. In that section I found:
System.ArgumentException: Requested value 'Version47' was not found.
I was targeting .NET Framework 4.7.2 so I downgraded the project to target .NET Framework 4.5, deleted the bin/obj folder contents and rebuilt the project. Then, running dumpbin /exports showed my HelloWorld function!
It doesn't appear the package is compatible with .NET Framework 4.7.2.
QUESTION
I have a third-party C DLL, that came only with its header file as API. I want to be able to call one of its functions. The C header file looks like this:
...ANSWER
Answered 2021-Nov-22 at 07:32After deep research, I found out how to call from C# to the C DLL.
The C# code should be:
QUESTION
Code:
...ANSWER
Answered 2021-Nov-02 at 18:30Do I have to add my macro (MY_API) to the B class?
If that B
class is also exported/imported (which, presumably, it is), then: Yes, you do.
Try the following code, where we are building the DLL and exporting the classes:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install DllExport
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page