开发者

Creating dll files

开发者 https://www.devze.com 2023-02-01 04:30 出处:网络
How c开发者_运维知识库an we create a .dll file from an existing .cpp file? I have my HelloWorld.cpp and HelloWorld.h file already created.

How c开发者_运维知识库an we create a .dll file from an existing .cpp file? I have my HelloWorld.cpp and HelloWorld.h file already created.

Please help. Thank you.


It depends, what compiler (and version) are you using? I'm guessing MSVC++, so Dynamic Libraries are normally a built-in template (probably named 'Win32 DLL') you can use. (There is also 'Class Library', which is similar.)

Your header file signatures should probably also contain __declspec(dllexport) to make sure the compiler makes them visible.

Change the configuration type to 'Dynamic Library' (under Properties->Configuration Properties->General) and build.

Remember: DLL files are just normal plain old executables... They can contain a Main(), but they don't need to, just a collection of classes is also perfectly fine... You can often even simply rename .exe to .dll, though every compiler has its own little things...

A useful link might be: http://msdn.microsoft.com/en-us/library/ms235636%28v=vs.80%29.aspx


That's platform/compiler dependent. On Windows, with Microsoft Visual C++, you would say:

cl /LD HelloWorld.cpp
0

精彩评论

暂无评论...
验证码 换一张
取 消