Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

How do I compile a .cpp source file into a .dll?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
748 views
Welcome To Ask or Share your Answers For Others

1 Answer

There are two steps you need to follow in order to compile a dll:

  • Compile your source files to object files
  • Link your object files to a dynamic link library (DLL)

Here is one example using gcc:

  1. gcc -c source.cpp //compile sources; will output "source.o"

  2. gcc -shared -o mydll.dll source.o //add -shared to create a dll, will output "mydll.dll"


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...