- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have a non-COM dll that I would like to run under MTS. It has only one exported entry point and lots of global variables. If I make a VB wrapper dll could the dll be reentered from a second thread before the first thread gets done? I am worried that multiple concurrent calls to the dll will get mixed together but I don't know if that happens. I have never made MTS things before. Will a second thread be blocked until the first thread is finished? Has anyone tried this? Any suggestions? Do I have to make a COM interface? Thanks everyone!
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If I make a VB wrapper dll could the dll be reentered from a second thread before the first thread gets done? I am worried that multiple concurrent calls to the dll will get mixed together but I don't know if that happens. Will a second thread be blocked until the first thread is finished?
Not automatically -- you have to take care about that. There are several blocking mechanisms provided by Windows (events, mutexes, critical sections). Basically, you have two options:
a) To rework your dll to be reentrant. This would require quite a lot of job; in general, all variables in reentrant Dlls have to be AUTOMATIC (there's a compiler switch), so there should be no global data -- and it's a pain to rework a program with lot of commons in this way. You'd also have to link with multithreaded libraries.
b) To simply disallow reentry while a calculation is still in progress. Here you can find a sample with named mutexes (it is referred to instances of an application, however the approach would work in your case also) -- just take care that you destroy the mutex just before return (otherwise, you'll be able to run calculation only once :-)) with CloseHandle.
I'm not familiar with COM so I can't tell you about that.
HTH
Jugoslav
Not automatically -- you have to take care about that. There are several blocking mechanisms provided by Windows (events, mutexes, critical sections). Basically, you have two options:
a) To rework your dll to be reentrant. This would require quite a lot of job; in general, all variables in reentrant Dlls have to be AUTOMATIC (there's a compiler switch), so there should be no global data -- and it's a pain to rework a program with lot of commons in this way. You'd also have to link with multithreaded libraries.
b) To simply disallow reentry while a calculation is still in progress. Here you can find a sample with named mutexes (it is referred to instances of an application, however the approach would work in your case also) -- just take care that you destroy the mutex just before return (otherwise, you'll be able to run calculation only once :-)) with CloseHandle.
I'm not familiar with COM so I can't tell you about that.
HTH
Jugoslav

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page