Reputation: 14306
I did some research and I learned that if I run a program my system will automatically start it in a new thread. What does it look like with a DLL?
Some pseudo-code from a DLL, extern_func()
is exported from the DLL:
func1()
{
while(true) ...do something;
}
extern_func()
{
...do something
func1();
...do something else
}
Now if call extern_func()
in my program, will it run the function in a new thread or do I have to do this explicitly?
Upvotes: 1
Views: 1123
Reputation: 23796
No, calling a method in another dll will not automatically start up a new thread.
Upvotes: 4
Reputation: 53970
When a program starts, a thread is created. This is usually called the "main" thread.
If you don't explicitly create other threads, or use functions that create other threads, all your code will run in that main thread, even if you call functions that come from a DLL/library.
Upvotes: 5