Click here to Skip to main content
15,891,423 members
Everything / DLL

DLL

DLL

Great Reads

by CMalcheski
A full-scale all-assembly .DLL module for the situations that warrant it can offer a tremendous power and speed boost over using inline ASM or intrinsics alone.
by Avelino Ferreira
The easiest way to implement the ToolStripControlHost and ToolStripDropDown classes, in a UserControl, in order to display a Container/Control beyond the limits of its Parent Container and Parent Form, with very few lines of code. Let's uncomplicate ...
by pasztorpisti
An advice to make your DLL interface more attractive and easier-to-maintain even in cross-platform projects
by Irfan alam
A library for creating a voice and text conferencing application

Latest Articles

by Bruno van Dooren
An introduction to exporting functions from DLLs
by Bruno van Dooren
In this article, I explain how to create win32 style DLLs and what the various significant intricacies are.
by Philippe Cayouette, Sebastien Gibeau
Solution using smart pointers' custom deleters
by vblover Programmer
Create a resource-only DLL

All Articles

Sort by Updated

DLL 

25 Jan 2024 by Bruno van Dooren
An introduction to exporting functions from DLLs
19 Jan 2024 by OriginalGriff
We aren't tech support for MS: they have a huge number of people (most of which are pretty technical) who do just that and can really help - and they can dive into your PC with your permission and work out what is actually wrong and help fix it....
19 Jan 2024 by BobbyStrain
Is there a way to fix the corrupted files? I have a laptop with a good file. Can I simply replace the corrupt file with the good one? What I have tried: I haven't tried anything. I use my laptop for things that don't work on the corrupted desktop.
11 Jan 2024 by Bruno van Dooren
In this article, I explain how to create win32 style DLLs and what the various significant intricacies are.
20 Nov 2023 by samthelab
Okay OriginalGriff, RSVP I have written a C# front-end program, in which calls a bunch of DLL "C" functions(API's). and the communications between the two parts has been great. But recently, I was working on the program and must have done...
19 Nov 2023 by Dave Kreskowiak
Typically, "BadImageFormatException" means you're trying to mix 32- and 64-bit code in the same process. You're either trying to use 64-bit .DLL's in your app that's running as 32-bit, or you're trying to use 32-bit .DLL's in a 64-bit app. You...
3 Nov 2023 by Member 11400059
I created DLL with C# .NET Framework 4.5 and the build on Any CPU. I want to use this DLL to read the motherboard and Hard Drive Serial number. After I copy my DLL to the Library Folder of Meta trader (for mql4 and 5) and import it to my Custom...
2 Nov 2023 by Member 11400059
Thank to @Dave-KreskowiakWatch I find the MQL5 solution. and now I Find the solution for mql4 too. you can use this 2 link for the start: https://www.mql5.com/en/forum/353293[^] Calling a DLL from MQL | Andres Jaimes[^] first of all we should...
2 Nov 2023 by Dave Kreskowiak
Where to begin. Basically, from the examples I've seen, you've got most of your code wrong to work with MQL5. First, the methods in your SystemInfo class have to be marked "static": using System.Management; namespace SystemInformation { ...
2 Nov 2023 by Richard MacCutchan
Sorry, I know nothing about MQL. However looking at the code you have, you are declaring the two methods as local to the module that you call them from. But since those methods do not exist, that is probably the cause of the error. The #import...
24 Oct 2023 by samthelab
What does this mean and how do I fix it?? 1>C:\dllmain.cpp : warning C4747: Calling managed '_DllMain@12': Managed code may not be run under loader lock, including the DLL entrypoint and calls reached from the DLL entrypoint...
7 Oct 2023 by MichaelEriksen
I am developing on a c# web project with aspx pages and need to create a dll with several dialogboxes made of Panels and DIV's. It is possible for me to create a library and call it from the codebehind in my mainproject. But I can't put a DIV,...
17 Aug 2023 by temuco
All under .NET 7.0 Given is a custom library isential.crypt.dll that contains no external dependencies. A NuGet package was created from it and stored in a local package source. A second custom library named isential.MySqloverSsh.dll uses three...
16 Aug 2023 by temuco
I noticed that there is a difference between the version of a NuGet package and the version of the assembly it contains. Previously, I had set the assembly version to "1.0.*", which meant that it was automatically incremented with each build....
21 Jun 2023 by YrthWyndAndFyre
A DLL becomes part of your process once loaded. If every action you take related to the DLL (including loading/unloading, if applicable) is wrapped in a try...catch() block, any exceptions that escape from the DLL will be trapped by your process...
21 Jun 2023 by Learning Cow
Hi All, I have a dll , of which an API I am using in my app , I am expecting a crash in DLL when a large data is fed to the API , will this also crash my app ? What I have tried: I am trying to write a fuzzer to detect crashes in DLLs
21 Jun 2023 by CPallini
Yes. The DLL code is mapped in the process memory space, see, for instance: About Dynamic-Link Libraries - Win32 apps | Microsoft Learn[^].
19 Jun 2023 by Wassa Bizo Ismaila
I have a WPF project that I need to compile, load as a DLL file, and access its components programmatically. I'm currently using the Roslyn Compiler in my function, but I'm open to alternative solutions if they can help resolve my issue. The...
9 May 2023 by Member 11072126
Hi All, I am currently working on a project where there are many .dll files to be read from the main application. The other supportive projects are build successfully and the .dll files are also created. While running the main application, its...
14 Apr 2023 by Mạnh Lê
Why Return only First Character when Convert Cstring to LPCSTR What I have tried: Dear guy I'm convert Cstring to LPCSTR with some code below CString strData1 = L"ABCDE"; LPCSTR spData = (LPCSTR)(LPCTSTR)strData1; MessageBox(NULL, strData1, L"CString strData", MB_OK); //=> ABCDE...
14 Apr 2023 by Member 11658520
one more thing , when you are using function check there should be a function for unicode also.. like in registry there is a function RegCreateKeyExA but for Unicode there is another version of same function called RegCreateKeyExW Mumtaz Ali
24 Feb 2023 by Philippe Cayouette, Sebastien Gibeau
Solution using smart pointers' custom deleters
21 Feb 2023 by Member 15930906
Is there a thrid party library for MS office that is free of cost?
7 Feb 2023 by mohammad hasani
I have a C++ class and I want to import it into C#. class __declspec(dllimport) string { public: string(); string(const char*); string(const std::string&); ~string(); int size() const; int lenth() const; const char* c_str() const; ...
26 Jan 2023 by DrgIonuţ
I am trying to establish a connection to InfluxDB database. After I publish my c# MVC app on IIS and run it, I get this error: Quote: System.IO.FileLoadException Message : Could not load file or assembly 'netstandard, Version=2.1.0.0,...
26 Jan 2023 by Richard Deeming
You're referencing a library or NuGet package which is build for .NET Standard 2.1; that library doesn't support any version of .NET Framework. .NET Standard | Microsoft Learn[^] You need to check your project's dependencies.
26 Jan 2023 by OriginalGriff
You are specifically telling it to load an assembly "netstandard" Version=2.1.0.0 and the error message is pretty specific: The located assembly's manifest definition does not match the assembly reference. Which means that the versions don't...
20 Jan 2023 by JudyL_MD
If you use the DllImport mechanism [DllImport("DllTeste.dll", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)] public static extern IntPtr TesteEnviaXml(); to create your access to the functions in DllTeste.dll, you...
20 Jan 2023 by Cristiano Rogoy 2023
Hello, I have a dll made in Delphi that is working perfectly, I use its functions within C# at runtime, but I am not able to clean it from memory. What I have tried: [DllImport("kernel32.dll", SetLastError = true)] [return:...
18 Jan 2023 by Chris Stols
you neeed to release the dll running under task manager
8 Jan 2023 by RaHoCodeProj
Hi I have 2 projects with same linked source code. I gave similar dll same AliasName. On each project switch, I have to swap the header in my cs-files. What can I better do? What I have tried: extern alias AcMgdCore; extern alias AcMgd;...
8 Jan 2023 by Michael Haephrati
I agree with Gerry that a Preprocessor Directive, such as #if ... would be the first choise. Other options can be: - Maybe create common header that will include all the necessary headers for both projects. This way, you only have to include a...
1 Jan 2023 by merano99
Richard has already described the first obvious error. The error messages with the inconsistent DLL bindings disappear as soon as the functions are declared with "dllexport". After that there can still be problems with the path. While it is...
1 Jan 2023 by JESUS CORTES CAMACHO
Hola estoy aprendiendo a crear una DLL y luego utilizarla, C++ este es mi primer ejercicio. Lo estoy probando en línea de comandos "cl.exe". EL resultado es realizar operaciones básicas. En la línea de comandos escribo cl /c dllmain.cpp Esto para...
31 Dec 2022 by Richard MacCutchan
As far as I can see you did not define BUILDING_DLL when you compiled the dll code. See Creating and Using a Dynamic Link Library (C+) | Microsoft Learn[^].
15 Dec 2022 by vblover Programmer
Create a resource-only DLL
3 Oct 2022 by Qasim Ali Oct2022
I have an issue which I don't know where to start to solve I have to make PDF data file using unity c# in webGL build I already done this with HTML but is there any way I can do this with unity C#. What I have tried: I tried some basic threads,...
26 Sep 2022 by MrG_
For what it is worth, I managed to resolve this. Extracts of the relevant code: from comtypes import c_double, c_short, client from ctypes.wintypes import VARIANT_BOOL from comtypes.automation import _midlSAFEARRAY my_dll =...
26 Sep 2022 by MrG_
Hi all, I have a 32bit VB6 DLL which has two functions. I want to access those functions from my 32bit version of python. First issue is that I can't seem to see the functions when I load the dll: from ctypes import * dll =...
23 Jul 2022 by ernteSKY
I have my Main Project where are some Forms and Classes. I also created some Shared Library projects (.dll) in the same Solution. I can access any kind of Shared Library projects from my Main Project. Of corse all of them added as a Reference...
23 Jul 2022 by Dave Kreskowiak
DO NOT DO THIS! Setting a reference from the Shared Library project to the main project is indicative of bad design, violating encapsulation and separation of concerns. The library project should know nothing at all about whatever project is...
23 Jul 2022 by OriginalGriff
The problem is simple: the main project references the shared project already - so when you try to add a reference to the main project in the shared project it creates a circular reference: A refers to B which refers to A which refers to B which...
24 Jun 2022 by lewist57
Simple, and somewhat naïve, questions: 1) Apparently one can generate 64 bit .exe from VB.NET in Visual Studio 2022; how about VS 2019? 2) Assuming one generates a 64 bit .exe for VB.NET, can it access 64 bit DLLs (generated in other...
24 Jun 2022 by Dave Kreskowiak
This is not imposed by VB.NET or Visual Studio. WINDOWS does not allow mixing of architectures in the same process. No, you cannot load a 64-bit .DLL in a process running 32-bit, and the other way around. The languages the .DLL's and main...
22 Jun 2022 by Member 11478798
Hi, I have an application that was written maybe 10 years ago. Runs fine on a xp machine. When I install it on windows 10 it runs but get the following error: retrieving the com class factory for component with clsid failed due to following...
22 Jun 2022 by OriginalGriff
In addition to what 0x01AA has said, also check the mode of the DLL: given it's age and target OS it's almost certainly a 32bit DLL - and unless your app is also compiled for 32bit it won't work as you can't mix the two unless the DLL is data...
20 Jun 2022 by Martin Fisher2
There must be a match between the configuration of the managed code and the DLL, so you should create different versions of the DLL for Release/x86 (32 bit), Debug/x86, Release/x86 and Release/x64
19 Jun 2022 by Member 10854414
0 down vote favorite I have following Code in C#: (I used R.Giesecke Dllexport Template to create a unmanaged Dll with C#... it creates me a ".lib" and ".dll" file with (managed) C# )//UnmanagedExports.csusing System;using System.Collections.Generic;using System.Text;using...
7 Jun 2022 by blog.vitorrubio.com.br
I had same problem and tried some workarounds 1) make your plugin classes to be necessarily sealed and filter only by sealed types var types = AppDomain.CurrentDomain.GetAssemblies() .SelectMany(s =>...
7 Jun 2022 by C Pottinger
I am changing a project of mine to use plug-ins for certain components (called FeedReaders), instead of having them defined in the main solution. I am following the technique present here by Duke of Haren. I am also using NUnit as by unit testing...
6 May 2022 by KarstenK
Importing an class isnt always the best idea, but importing the data is more simple. You cant import classes with members of classes which arent supported. Read my article Calling-All-Stations and its code about a possible solution. When...
18 Feb 2022 by Member 14359403
I am in need of a little help, i'm trying to exit sub, if a test.dll is detected (test.dll is just example), and if the dll does not exist, just continue to do the other things in the code. I'm trying to do it like this, however even when the dll...
18 Feb 2022 by Andre Oosthuizen
You can use the following, should work fine - Sub main() If Not GetModuleHandle("test.dll") = Nothing Then Exit Sub Else ''Do other things End if End sub
18 Feb 2022 by Uzi Granot
PDF File Writer is a C# .NET class library allowing applications to create PDF files. The code was developed for VS 2022 and .NET6. The latest update is a major upgrade.
17 Feb 2022 by Richard MacCutchan
The GetModuleHandle function (libloaderapi.h) - Win32 apps | Microsoft Docs[^] returns either NULL (0) if the dll cannot be found, or a Windows HANDLE if it is found. So comparing it with the value 1 is unlikely to work. You should compare it not...
10 Feb 2022 by dj4400
Hi all, I am working with VS2017 in C++. I have a 3rd party DLL that I load in my program. When running my program on my PC the DLL is loaded correctly. I tried to run my program (compiled in release mode) on another PC, but the DLL failed to...
10 Feb 2022 by dj4400
I opened the DLL in Dependency Walker on the target PC and there was no red markings So i tried the dumpbin in the 1st PC to see what dlls does it use and i saw it was using just 2 dlls. I searched them on the target PC and saw that one WAS...
9 Feb 2022 by steveb
Get the "Dependency Walker" tool(from Microsoft by Steve Miller) for both 32 and 64 bit. Go to your other failing machine and drop that dll into the Walker window. You should see all the dependencies. If any are missing then you won't be able to...
9 Feb 2022 by Dave Kreskowiak
It has nothing to do with the IDE being installed. This usually comes down to your code being compiled to target "Any CPU", which means it runs as a 32-bit app on 32-bit Windows and a 64-bit app on 64-bit Windows. The problem comes down to the...
6 Feb 2022 by merano99
There seems to be programs that can do that. I found this with google. I don't know if it works. DLL to Lib - Convert DLLs into static libraries[^] UPX is not a good protection against reverse engineering, since UPX-packed programs can be...
6 Feb 2022 by Member 15198811
I wrote a simple network assistance. The login verification code identification uses the wmcode.dll provided by others, but this dynamic library is upx3 91 compressed, anti-virus software always indicates that it is poisonous, so I want to...
24 Dec 2021 by suleman Ali kazmi
Hello, I am very new to C# and C/C++. I wrote a code in C that stored 2 variables in an array and return the array. Using the P/invoke method I created a DLL library of this C function and imported the library to C#. While calling array, I am...
15 Dec 2021 by Member 15028314
I like so many other developers, develop useful tools which could be contained within these windows DLL files. But the question is; how can we(as developers) add our own new software API's up under our MS Visual Studio environment(s), so we can...
13 Dec 2021 by Member 12704287
I have a class library project which has a .xml file. It's property is set to "Copy Always" to "Output Directory". After building the project the file is getting copied to the output directory.but when I'm using this dll in other applications,the .xml file is not being copied to their output...
13 Dec 2021 by Member 13202792
you can use the post build if you are using VS, you can add a post build event like xcopy "$(ProjectDir)Views\ModuleAHome\Index.xml" "$(SolutionDir)MEFMVCPOC\Views\ModuleAHome\" /Y /I
2 Dec 2021 by Avtem
I wrote a DLL with hook of type WH_GETMESSAGE. What I want to do is store an std::vector inside that DLL and being able to manipulate it from my app. But the problem is that when my app calls DLL function createMyObjects() vector's size...
2 Dec 2021 by Rick York
Hook procedures are called in the context of the process that generates the message. Here is what the docs (Hooks Overview - Win32 apps | Microsoft Docs[^]) say on the topic : Quote: A global hook monitors messages for all threads in the same...
26 Nov 2021 by Ejrr1085
How to run a dll created with Visual Studio 2012, .NET Framewotk 4.5 in Visual Basic 6.0?
28 Oct 2021 by DevJr
Hello, i'm pretty new at C# (using VB.Net before), i wanted to use method from Benoit Blanchon from this post: .net - Using a 32bit or 64bit dll in C# DllImport - Stack Overflow[^] But i'm not sure about Quote: can be done in the static...
28 Oct 2021 by Dave Kreskowiak
I think you're looking for, though this may not work at all. You may have to move the code to a class separate from Program: (I don't have time to test this) namespace TestApp { static class Program { ... Your DllImport line(s)...
8 Oct 2021 by Avtem
So, i've been developing a DLL to use it in all my applications. As far as i know, you can use DLL's functionality without having to link it at build time. AutoHotKey seems to do exactly that (using DLL's functionality having only .dll file). So...
8 Oct 2021 by CHill60
Assuming you are meaning that you only want your applications to be able to use this DLL and no-one else's then you could require a licence key to be part of every call into it. Starting point A simple software key useful to protect software...
7 Oct 2021 by den2k88
Not really, DLL are also konow as "shared libraries". The only thing you can possibly do is edit the DllMain in order to recognize somehow the process that's trying to link it and prevent access on the basis of that. I never did something like...
7 Oct 2021 by OriginalGriff
No, not really. A DLL is a library file - in effect it's an executable that lacks the "stub" that tells Windows where to start running the code. As such, you can't encrypt it without Windows not knowing what to do with it! And DLL files are -...
10 Sep 2021 by ATISH PAI DUKLE
i m trying to develop a dll which will pull data from tally. in vb.net windows application project it runs. But when i use same code to develop a dll which is .netframework 4 build and registered in 64bit .netframework64 folder it gives error as...
10 Sep 2021 by Dave Kreskowiak
It's possible the Tally driver you're using is 32-bit only. Recompile your .DLL to target x86 instead of x64 or AnyCPU and give that a try.
28 Jul 2021 by acalafiore
Hi all, first time asking a question but I wasn't able to find a solution to my problem yet. We are starting a new project in .NET and we choose to divide it in differente libraries to maintain it easily. Or so we hope. To keep it as simple as...
28 Jul 2021 by acalafiore
I have chosen to include in each solution the project needed for references. This way there are no missing libraries while running. Not really what I wanted but it's the easiest way.
25 Jul 2021 by Chris Copeland
.NET optimizes out library references where they haven't been used. So if your "LibraryA" references a particular package but chooses not to use it, it may be optimized out of the DLL when compiled in release mode. I think the correct approach...
25 Jun 2021 by ♥…ЯҠ…♥
Hi everyone, I have a dll which is created using VB6.0. But i do not have source code for the particular dll file. I want the source code for that. I tried certain decompilers which my friend suggested to me. But i am not satisfied with the conversion. The code obtained is native...
7 Jun 2021 by KarstenK
You better send the keystrokes as array. Read the documentation and example. And check GetLastError when it doenst work. I guess you havent the access rights or the code is somehow protected against it.
6 Jun 2021 by den2k88
For the sake of science only, consider that SendInput sends keystroke events to the process window, which are processed by the main window function (message pump). Games usually manage their input with DirectInput, so your solution is bound to...
6 Jun 2021 by OriginalGriff
So ... you're trying to cheat a game, and your crude code doesn't work. Do you think that is something legitimate - no, you don't because your complaint about other ways is "many of WINAPI functions used for it are detectable!" And justly so....
1 Jun 2021 by Chris Losinger
I suspect you're going to have to create a DLL that can talk to the C++ DLL, and which exports a plain C version of the API. Then, you can use that DLL from C#. C++ C C#
1 Jun 2021 by Richard MacCutchan
You cannot import a C++ class into C#. The two languages are completely different and C++ runs under native Windows, while C# requires .NET. C# programs can access C-style functions via Platform Invoke (P/Invoke) | Microsoft Docs[^].
1 Jun 2021 by Chris Copeland
I feel like this is a follow-up to the other question asked here[^], why didn't you just put a comment on that question? As far as I'm aware you cannot share classes between C# and C++, it's just not a supported option. As I mentioned on the...
31 May 2021 by mohammad hasani
Hello, I have a C++ project which I want to convert into a C# project. I've converted the DLL calls and codes but when I run the C# version sometimes it runs and sometimes it gives me System.AccessViolationException and jumps out of the program...
31 May 2021 by Chris Copeland
I don't believe that C# has the capacity to automatically understand what a string type is in C++, it's natively unable to convert a C# string into a C++ std::string or otherwise. Instead of using base::string& as the last parameter consider...
31 May 2021 by KarstenK
You must take with string between C+ and C#. Here is working code C# interoperation article which concreates on a simple and working interface. When using C++ strings in C# than you must use these bstrings else you will fail.
20 May 2021 by Member 15134456
Recently I am making a UI asset for Unity. I used Unity 2020.1.0f1 for making and testing primarily. I now have a project in Unity 2021.1.3f1 and I want to use my UI asset. This asset is a unitypackage and contains 3 DLLs (1 C# DLL, 2 C++/CLI...
9 May 2021 by Member 15076657
I am using this as a reference to call my java class inside C program. But , JVM is not launching. Here is my code for launching jvm.
9 May 2021 by Richard MacCutchan
I do not know where you found that code but the official documentation is different: The Invocation API[^]. Also why do you write: mbstowcs(t, "C:\\Program Files (x86)\\Java\\jdk-16.0.1\\jre\\bin\\server\\jvm.dll", 400); jvm_dll =...
8 May 2021 by Ralf Meier, Shah Samiur Rashid
Codeless Combobox for VB.NET/C# platform with MySQL/SQL Server database applications
1 May 2021 by dj4400
I am looking for an example or a walkthrough for creating a c++/cli wrapper for a c# dll to be used (loaded statically/dynamically) in an unmanaged c++. I found examples of a wrapper for the other way around (c++ dll to be loaded in c#) but none...
1 May 2021 by OriginalGriff
See here: Calling C# .NET methods from unmanaged C/C++ code[^]
3 Mar 2021 by Member 14649480
Hi, I have developed a c# dll that makes http reqest using System.Net namespace. If I call the dll methods from an c# programm everything workes fine but i need to use this dll from native c++ code. For this i used COM interop service. All goes...
3 Mar 2021 by OriginalGriff
Firstly,you aren't calling GetResponseAsync in that code. Secondly, half the other stuff we have no idea what exactly they are: JObject, what is returned by your GetResponse call. Thirdly, why are you preparing a byte array version of your...
1 Mar 2021 by Fazi_13
Hai i am using console application in c++,in windows application MFC dll contains string table assume like this i will un rar the dll so some files are extracted in that (string.txt)will be there in that ID and values will be there in the same...
28 Feb 2021 by Richard MacCutchan
In order to find all resources of a type you need to enumerate the names in the type. See EnumResourceNamesA function (winbase.h) - Win32 apps | Microsoft Docs[^].
26 Feb 2021 by Member 15011436
Hi, I am trying to follow Using Shared Memory in a Dynamic-Link Library - Win32 apps | Microsoft Docs[^] This lesson says to use BOOL WINAPI DllMain(HINSTANCE hinstDLL, // DLL module handle DWORD fdwReason, // reason...