
??? Process Shared DLL and Data ???
Hi Adrian,
I tried to call my DLL from two apps and could start the applications. But
because the DLL instance tried always to use the same file, the "second"
file was locked and the access was denied for the second instance.
Ok, now I tried to insert following code from KB article Q109619 in my def
file:
SECTIONS
.bss READ WRITE SHARED
.data READ WRITE SHARED
and inserted also the linker options:
-section:.data,rws -section:.bss,rws
Than I compiled and linked my DLL and got the linker warning:
LNK4092
I ignored this warning and I started two applications which uses my DLL:
The first instance started without problems, the seconds got the third
ASSERT() in the following MFC function:
inline void* CThreadSlotData::GetThreadValue(int nSlot)
{
ASSERT(nSlot != 0 && nSlot < m_nMax);
ASSERT(m_pSlotData != NULL);
ASSERT(m_pSlotData[nSlot].dwFlags & SLOT_USED);
....
Also I have to write that I tried to use the MFC as static lib and as shared
DLL in my DLL. Both versions had the same warning and ASSERT(...)
* Do you have an idea what could be wrong?
Regards
Roland
Quote:
> Hi,
> Have a look at KB article Q109619.
> Regards,
> --
> Adrian O' Neill
> Remove * in email address to reply
> > I'm writing a DLL to create special logfiles (in ASCII-files and/or MS
Jet
> > database files). Everything is perfect if only one application uses this
> > DLL. The MFC class instances to handle the files are allocated with
new()
> > and I increment a counter in openmyfile(...), if the file with the
> specified
> > name is still open and I decrement the counter in closemyfile(...). If
the
> > implemented file instance counter is zero I close the file.
> > Now more application should use the same DLL and only one instance of
this
> > DLL should be loaded on the NT/2000 system. Each application using this
> DLL
> > should be able to write inte the same (!!) file or database at the same
> > time. To serialize the calls I could use critical sections.
> > But:
> > * What I have to do to make sure that each application (process) uses
the
> > same DLL instancen and instance data?
> > * What I have to do that each application (process) is able to write to
or
> > to read from the same file?
> > Regards,
> > Roland
> > --
> > SPLINES-Software, Technical Software Development
> > Phone: +43-6246-75385, Fax: +43-6246-79241
> > PGP Fingerprints:
> > Roland J. Graf = 0592 DA69 440A E137 4ED5 22AA 3D05 CF60 FABD E14E