Depend on DLL without header file, worked in Visual Studio 2005 - visual-studio

I have a legacy project that used to be build in Visual C++ 2005 Express, and it depends on a certain third party DLL. As far as I can tell it doesn't come with a lib or header file.
The project compiles fine in Visual C++ 2005, here is a screenshot showing the DLL visible and browsable in the object explorer. The code can also use it without #include or anything like that, which is pretty weird.
Importing the project into Visual Studio 2019 works as well, the code can still use the DLL and it is listed under both the dependencies and the references:
I now want to achieve the same thing in a new project, but I cannot figure out how to register the DLL as a dependency. Things I found online and tried:
"Just include the header or lib file" doesn't work, I don't have one
LoadLibrary() and GetProcAddress() are awfully contrived and don't seem necessary because it's clearly possible without.
Create your own lib file doesn't work either, dumpbin doesn't show any symbols for my DLL: image
How do I register the DLL as a dependency? And where does Visual C++ 2005 get the list of methods in the DLL from is the first place?

Related

Visual Studio 2017 - Create DLL from Only Static Libs (No sources)

We have a visual studio project to produce a DLL file, and we've now refactored all the sources out into 3 separate projects which produce static libs. This leaves behind the .def file, and some pre and post-build actions related to the dll itself in this project. We'd like to keep the generation of the DLL and all the additional behavior separate from the other projects if we can.
Unfortunately, now when we try to "build" this project, it does not produce a DLL anymore (presumably because there are no sources that reference any of the libs).
I've added /WHOLEARCHIVE:themainstaticlib, but that doesn't seem to be enough.
If it's possible to have a Visual Studio project that JUST creates a DLL from static libs and a def file (and a /wholearchive directive), can someone please let me know how?

Visual Studio DLL reference dependencies

I'm new to the world of .NET and I'm trying to understand the build process. If the concept of DLLs is to resolve references at run time why does visual studio need to to know about DLLs at compile time in order to build an executable ? Can't seem to find a definitive answer anywhere.
DLLs are loaded at runtime so your code can call code in that DLL, indeed. However, they are also needed at compile time so you can write code calling into that library.
Back in C++ I think that was done with .lib files or via COM, so the compiler didn't actually need the DLL. In .NET that's different because the DLL contains the code to run and the interface so other programs can use it.

Compile VxWorks project in Visual Studio

I have a VxWorks project that compiles under Toronado on my Win7 machine. I am trying to convert the same project to compile in my Visual Studio 2010. I don't need it to complete to where it creates a .o/out file but at least get through all the defines/includes and etc. so I can use Visual Studio's IDE for definition jumping and etc..
I'm at a point where I'm getting a 'undeclared identifier' for "_interrupt" which is included in several include files from the ..\tornado\target\config\ folder.
I'd appreciate any suggestions
Thanks
I would like to comment on this but don't have enough points.
I do the same thing using eclipse instead of visual studio, I don't do anything special to make it work.
It sounds like you are trying to do the link even though you don't want to. Make sure when you create your project you set it up to create a library not an executable, it should do the compile then but no linking.

How to Package a VC++ Win32 Console App and DLL

I have developed a Win32 Console app DLL and a small tester application for it. As far as I know neither uses MFC, .COM, .NET or dot-anything else. Development platform is VS2009 on WinXP/SP3
When I give the DLL and EXE to someone else, they are unusable. Attempting to use them generates errors similar to "Application cannot be used, the application configuration is wrong." and "cannot find xxx.dll" (not exact wording on these error messages).
I have learned from reading that there are dependencies that must ship with the EXE and DLL. These dependencvies seem to be specific to VS 2009 abd should include the MSVCRT09, etc.
When I followed MS's instruction to make a setup.exe/MSI installer for a Setup and Deployment Project (http://msdn.microsoft.com/en-us/library/ms235317%28v=VS.90%29.aspx) I add the dll to the project, move it to the "MyLibrary" folder and no dependencies are found or listed in the Solution Explorer. Yet, I know there are dependencies, DEPENDS.EXE says so.
Can anyone walk me through this or name a better site with instructions. Once again, MS's help isn't all that helpful.
thanks,
Wes
Visual Studio 2008 is version 9.0. A program built with Visual C++ 2008 normally does have dependencies on the C run time library MSVCRT09, as you discovered. If the C run time library is not installed on the destination PC (either already installed or as part of your setup project) then your application fails, as you discovered. It is no surprise that DEPENDS.EXE displays the dependency. The only question seems to be why Visual Studio 2008 doesn't display the dependency in its Solution Explorer window.
Before building your Visual Studio setup project (MSI and setup file), Visual Studio might not have had any reason yet to search for dependencies. But after the setup project is built, in my experience the Solution Explorer does show the dependencies it found, next to other dependencies that you set explicitly. If those don't show up after building, something is weird.

Using MinGW/GCC built DLL in a Visual Studio 2010 C++/CLI project

I have a communication library built on top of Qt and Google Protocol Buffers. It's currently being built with MinGW/GCC on Windows. My goal is to use the same library in C# on .NET, with the help of a thin wrapper on top using C++/CLI (bridging the unmanaged code with managed code).
I tried using the MinGW produced DLL directly in my C++/CLI project, but I keep getting linker errors (cant remember the error codes right now, but something about missing tokens and functions/signatures).
First question is: Should I be able to use the MinGW-produced DLL with the Visual Studio compiler/linker? Or do I need to compile the library again, using only VS compiler for all projects?
If I should be able to use the MinGW-produced DLL directly, how do I reference it in Visual Studio 2010? In project settings it seems to look for *.lib files, but I can't find any .lib files in the output of MinGW/GCC. It does produce *.a files, but it seems like Visual Studio don't handle this kind of file..
I should also mention that both Qt and protobuf are also compiled with MinGW. But I can of course recompile all the parts in VS 2010 if necessary.. Would have been nice to save the recompile time though, since our buildserver already has a working setup using MinGW.
The easiest way to use it would be by recompiling it with Visual Studio. This is when I am assuming C++ types and classes used in the interface you intend to use.
In case you have a C interface to this library you could dynamically load the library via LoadLibrary and use GetProcAddress to access those functions.
However it depends completly on the way how you intend to use the library.

Resources