Click here to Skip to main content
15,897,704 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: binary to GdiPlus::Image Pin
Mark Salsbery3-Feb-08 7:41
Mark Salsbery3-Feb-08 7:41 
GeneralRe: binary to GdiPlus::Image [modified] Pin
followait3-Feb-08 21:16
followait3-Feb-08 21:16 
GeneralI can't modify the former msg, the 'edit' button is out of the view Pin
followait3-Feb-08 23:03
followait3-Feb-08 23:03 
GeneralRe: binary to GdiPlus::Image Pin
Mark Salsbery4-Feb-08 5:33
Mark Salsbery4-Feb-08 5:33 
GeneralRe: binary to GdiPlus::Image Pin
bob169723-Feb-08 9:05
bob169723-Feb-08 9:05 
GeneralRe: binary to GdiPlus::Image Pin
bob169723-Feb-08 9:13
bob169723-Feb-08 9:13 
GeneralDLL Function call Pin
ginjikun3-Feb-08 1:09
ginjikun3-Feb-08 1:09 
GeneralRe: DLL Function call Pin
Gary R. Wheeler3-Feb-08 1:30
Gary R. Wheeler3-Feb-08 1:30 
The short answer is yes. Any number of threads can call a function in a DLL at the same time; the DLL calling mechanism allows this.

The real answer is it depends on the function in the DLL. The DLL function must be designed to be thread-safe. In other words, you must know that the function can be called from multiple threads safely. If the function uses a global resource, it must protect accesses to that resource so that its state isn't changed incorrectly by multiple threads.

If you don't know that the function is thread-safe, you can make it so by writing your own wrapper, something like this:
static CCriticalSection MyFunction_CS;
void Function(...);
void MyFunction(...)
{
  MyFunction_CS.Lock();
  Function(...);
  MyFunction_CS.Unlock();
}
Intead of calling Function(...) directly, you call MyFunction(...) which uses a critical section to ensure only a single thread at a time can call Function(...).

Software Zen: delete this;
Fold With Us![^]

GeneralRe: DLL Function call Pin
ginjikun3-Feb-08 1:38
ginjikun3-Feb-08 1:38 
GeneralRe: DLL Function call Pin
Gary R. Wheeler3-Feb-08 1:46
Gary R. Wheeler3-Feb-08 1:46 
GeneralRe: DLL Function call Pin
ginjikun3-Feb-08 2:03
ginjikun3-Feb-08 2:03 
GeneralRe: DLL Function call Pin
Gary R. Wheeler3-Feb-08 2:17
Gary R. Wheeler3-Feb-08 2:17 
GeneralRe: DLL Function call Pin
ginjikun3-Feb-08 2:33
ginjikun3-Feb-08 2:33 
GeneralRe: DLL Function call Pin
Gary R. Wheeler3-Feb-08 2:41
Gary R. Wheeler3-Feb-08 2:41 
GeneralRe: DLL Function call Pin
ginjikun3-Feb-08 3:13
ginjikun3-Feb-08 3:13 
GeneralRe: DLL Function call Pin
Gary R. Wheeler4-Feb-08 23:55
Gary R. Wheeler4-Feb-08 23:55 
GeneralRe: DLL Function call Pin
CPallini3-Feb-08 2:12
mveCPallini3-Feb-08 2:12 
GeneralRe: DLL Function call Pin
ginjikun3-Feb-08 2:36
ginjikun3-Feb-08 2:36 
GeneralRe: DLL Function call Pin
CPallini3-Feb-08 2:44
mveCPallini3-Feb-08 2:44 
GeneralRe: DLL Function call Pin
ginjikun3-Feb-08 3:10
ginjikun3-Feb-08 3:10 
GeneralRe: DLL Function call Pin
Iain Clarke, Warrior Programmer4-Feb-08 1:33
Iain Clarke, Warrior Programmer4-Feb-08 1:33 
Generallink with C runtime library Pin
George_George2-Feb-08 21:48
George_George2-Feb-08 21:48 
GeneralRe: link with C runtime library Pin
Gary R. Wheeler3-Feb-08 1:38
Gary R. Wheeler3-Feb-08 1:38 
GeneralRe: link with C runtime library Pin
George_George3-Feb-08 14:18
George_George3-Feb-08 14:18 
GeneralRe: link with C runtime library Pin
Iain Clarke, Warrior Programmer4-Feb-08 1:42
Iain Clarke, Warrior Programmer4-Feb-08 1:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.