How create a lib file while creating exe file - visual-c++

I have an legacy application which builds into exe.
I am using Visual Studio 6.0 and the application is an c++ application. It used many lib files, built in VS6.0. Now i need to use the api's which in the executable. I want to create a lib file while it is creating an exe. I cannot change the code of the legacy application.
Any help is highly appreciated.
Thanks,
AH

Create a separate library project and add any source files with APIs you want to reuse into it. It's probably cleaner to also remove those files from the exe project and make the exe project depend on the library project, but this isn't strictly necessary.

Related

Why does visual studio need a solution file for nodejs projects?

I wanted to make a nodejs application that could be edited using IDEs/editors other than visual studio, and was wondering why a solution file was needed, as dependencies are managed by npm.
The solution file holds a lot of data to setup your IDE. Most IDE's store some project specific data in your project root. The solution will just map out the actions of the run/debug actions, and specify other project specific parameters.
Because solution file contains reference of assembly files and other dependencies. You can check it by opening solution file in notepad.

Calling .dll in linux environment in c++

I have windows dynamic linked library which I want to access from Linux environment. I don't have the source code of that library, so I cannot build .so file.
Is there a way by using Winelib or any other library or tool for converting library file to .so file, so that I can call functions defined in that library?
There is no easy way to do it, because the DLL cannot run in Linux enviromnemt all by itself. It will probably rely on user32.dll msvcrt.dll and friends at runtime, so you'll have to provide those files as well.
You can use winelib, but it doesn't just convert a .dll to an .so. You'll have to link the whole project that wants to call the DLL against winelib, and include the DLL itself with your app at runtime. If you are trying to port a Windows app to Linux, winelib will be able to convert your makefile for you, but it's far from automatic for complex projects.

Static library file generated from Xamarin Studio

I have a C# project which have all the business logic files. So i need to use those files in ios project. i,e I need to create a framework or library from '.cs' files(C# files).
Is it possible to achieve this by using 'Xamarin'?
I have tried creating the static library project in 'Xamarin Studio'. But i can't find the '.a' lib file generated when i build the project.
Can i create a static library .a file from Xamarin?. If so, then can i use that project in my iOS xcode projects?.
Short answer: no, you can't create a static native library out of a managed project.
But that doesn't mean you can't call your managed call from the native part, but at the end, your project will still be a Xamarin.iOS project.

does every .exe file need a new project in Microsoft Visual C++?

My background is Linux and traditional makefiles. I have a project where the makefile builds several dozen executables I can then run to perform tests against the library being developed. This library is now ported to Windows.
My question: In Microsoft Visual C++, do I have to create a new project for every individual test .exe file? Or is there a way to create 1 project that will easily build all of the .exe files? E.g., test001.cpp becomes test001.exe, test002.cpp becomes test002.exe, etc.
I'm using Microsoft Visual C++ 2010 Express. Right now what I do is click on File->Add->New Project...->Win32 Console Application->... for every test executable. But it would be nicer if all these test files could be built without a new project for each one.
You need to have one project per executable, but you can have multiple projects per Visual Studio "solution".
When you build a solution, all of its projects get built. If you need the projects to be built in a specific order within the solution, you can easily set up dependencies.
If you're using Visual Studio in the normal fashion, then yes, each VS project (i.e. each .vcproj file) corresponds to exactly one output file (an executable, DLL, or static library).
You can also use Visual Studio with makefiles though, if you want. Just write your makefile as usual, except the C++ compiler is the cl.exe in the VS binaries directory, the linker is link.exe, and of course all of the command line flags are completely different. You can even set your VS project to use make instead of its built-in system, so you can still use the IDE for editing and debugging.

Creating a static library with the Visual C++ 6 compiler instead of a dynamic library (DLL)

I am able to create a DLL, but I want it to compile into a .lib file using Visual C++ 6 (commmad line).
Any ideas?
Use a 'Win32 Static Library' project for that.
When you create a new project you have the option to create a Win32 Static Library.
Having just created one to check the options I see that the tabs on the project settings dialog are different to those for DLL project.
Your best bet is to create a new project and copy the source files across. If you need the code to compile into both then you'll need to create the projects in the same directory (but with different names) or link the source from one directory to the other.

Resources