- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
Hello!
I am trying to create an application that is going to share data with several Windows services using DLLIMPORT.
Both the Windows services and the desktop application are created using Intel Visual Fortran.
The different Windows services seems to share data with each other, there is no problem there. Also if one of the services are running in debug mode on the desktop, it shares data with the desktop application.
But I have troble making the desktop application share data with the service. The application is running but the data displayed are just initial values, though I can see (throug logfiles) that the different services share dynamic data between them.
So how can I make the service share the data also with the desktop application? Is there some kind of global namespace that needs to be used in the application, like for mutex names?
I am trying to run this on Windows Server 2012 platform.
Declaration of the shared data in the desktop application and the service:
!DEC$ ATTRIBUTES DLLIMPORT::/INTERNDEVICE/
COMMON /INTERNDEVICE/Antall_Interndevice, BufferStorleik,
c nDeviceNummer, nMeldingStorleik, strBuff, nForsteMelding,
c nSisteMelding, nowait
integer,volatile :: Antall_Interndevice
integer,volatile :: BufferStorleik
integer,volatile :: nDeviceNummer(cAntall_Interndevice)
integer,volatile :: nMeldingStorleik(cAntall_Interndevice)
integer,volatile :: strBuff(cBufferStorleik, cAntall_Interndevice)
integer,volatile :: nForsteMelding(cAntall_Interndevice)
integer,volatile :: nSisteMelding(cAntall_Interndevice)
logical,volatile :: nowait(cAntall_Interndevice)
Declaration of the DLL export used to build the .lib file and the .dll file:
parameter cAntall_Interndevice=20
parameter cBufferStorleik=1284
parameter cIntDevTabell=25680
!DEC$ ATTRIBUTES DLLEXPORT :: /INTERNDEVICE/
COMMON /INTERNDEVICE/Antall_Interndevice, BufferStorleik, nDeviceNummer, nMeldingStorleik, strBuff, nForsteMelding, nSisteMelding, nowait
integer*2 Antall_Interndevice
integer*2 BufferStorleik
integer*2 nDeviceNummer(cAntall_Interndevice)
integer*2 nMeldingStorleik(cAntall_Interndevice)
integer*2 strBuff(cBufferStorleik, cAntall_Interndevice)
integer*2 nForsteMelding(cAntall_Interndevice)
integer*2 nSisteMelding(cAntall_Interndevice)
logical nowait(cAntall_Interndevice)
data Antall_Interndevice/cAntall_Interndevice/
data BufferStorleik/cBufferStorleik/
data nDeviceNummer/8#200,8#201,8#202,8#203,8#204,8#205,8#206,8#207,8#210,8#211,8#212,8#213,8#214,8#215,8#217,8#220,8#221,8#222,8#223,0/
data nMeldingStorleik/4, 4, 4, 4, 4, 2, 2, 4, 2, 4, 4, 4, 4, 4, 6, 6, 6, 6, 6, 0/
data strBuff/cIntDevTabell*1/
data nForsteMelding/cAntall_Interndevice*1/
data nSisteMelding/cAntall_Interndevice*cBufferStorleik/
data nowait/cAntall_Interndevice*.false./
- Marcas:
- Intel® Fortran Compiler
Link copiado
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
There are two things you have to do in order to have multiple processes do read-write sharing of data in a DLL. You've done one of them, which is to make sure that the DLLEXPORTed variable is at least partially DATA initialized. The other is to link the DLL with the option /section:.data,RWS added to Linker > Command Line > Additional Options.
I'm not aware of anything else you need to do, other than make sure that all the executables are linked to the same DLL. Also, I recommend that the shared data be in a DLL by itself and not with any procedures in that DLL.
See the DLL > DLL_Shared_Data sample we provide when you install Fortran.
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado
Jeremy I think you are right. Earlier, with Windows 2003 and Compaq Visual Fortran, I had a similar problem, in that I couldn't access the same memoryspace as the service when logging in on the server with Remote Desktop. I could then avoid the problem by either logging in on the console (not using Remote Desktop), or if I used Remote Desktop with the -console or -admin option. Then I could live with the problem. But this seems not to work with Windows 2012. So I think the problem is kind of identified, but how to fix it?? Is it possible to specify session 0 when logging in on the server? For mutexes I can specify the "Global\" prefix on the mutex name to cross the border between the desktop application and the service. Is there a similar solution for shared memory and how to use that?
Steve, there is only one "deltminne.dll" file on the server, and the path to this file is specified in the PATH environment variable as a system variable, not a user variable. So I'm sure all executables are linked to the same dll.
- Marcar como novo
- Marcador
- Subscrever
- Silenciar
- Subscrever fonte RSS
- Destacar
- Imprimir
- Denunciar conteúdo inapropriado

- Subscrever fonte RSS
- Marcar tópico como novo
- Marcar tópico como lido
- Flutuar este Tópico para o utilizador atual
- Marcador
- Subscrever
- Página amigável para impressora