How do I compile a .cpp source file into a .dll?
相关问题
- Sorting 3 numbers without branching [closed]
- How to compile C++ code in GDB?
- Why does const allow implicit conversion of refere
- How to know full paths to DLL's from .csproj f
- thread_local variables initialization
相关文章
- vs2017wpf项目引用dll的路径不正确的问题
- Class layout in C++: Why are members sometimes ord
- How to mock methods return object with deleted cop
- Which is the best way to multiply a large and spar
- C++ default constructor does not initialize pointe
- Selecting only the first few characters in a strin
- What exactly do pointers store? (C++)
- Converting glm::lookat matrix to quaternion and ba
There are two steps you need to follow in order to compile a dll:
Here is one example using gcc:
gcc -c source.cpp //compile sources; will output "source.o"
gcc -shared -o mydll.dll source.o //add -shared to create a dll, will output "mydll.dll"
You have to compile cpp files into .obj files, then link them to produce a .dll.
A dll file is a library file, which is composed of many object files. This means you need to compile your .cpp file then combine it with any other files you need into the .dll.
Here's a tutorial I found with a quick google: http://www.icynorth.com/development/createdlltutorial.html
EDIT A fix for the above link since it's dead now https://web.archive.org/web/20130924001807/http://icynorth.com/development/createdlltutorial.html