- Отметить как новое
- Закладка
- Подписаться
- Отключить
- Подписка на RSS-канал
- Выделить
- Печать
- Сообщить о недопустимом содержимом
I'm creating a shared memory file mapping in a DLL in C++ and assign it to SM01
extern "C" {
__declspec (dllexport) char *SM01 = NULL;
}
I can use this in another C++ DLL by doing this
extern "C" __declspec(dllimport) char *SM01;
#define abc1 (*(int *)(SM01 + 4))
I can assign abc1 to a value in shared memory.
I would like to do the equivalent in a FORTRAN DLL but it's not working. Something like this.
USE, INTRINSIC :: ISO_C_BINDING
IMPLICIT NONE
TYPE(C_PTR), BIND(C) :: SM01
SUBROUTINE FORTRAN_LIBRARY()
INTEGER abc1
EQUIVALENCE (abc1,SM01(4))
abc1 = 555
END
Ссылка скопирована
- « Предыдущий
-
- 1
- 2
- Следующий »
- Отметить как новое
- Закладка
- Подписаться
- Отключить
- Подписка на RSS-канал
- Выделить
- Печать
- Сообщить о недопустимом содержимом
Wow, thanks for finding that. Maybe that's why the debugger crashes also?
- Отметить как новое
- Закладка
- Подписаться
- Отключить
- Подписка на RSS-канал
- Выделить
- Печать
- Сообщить о недопустимом содержимом
I didn't see a debugger crash using 17.0.2. The type mismatch alone would not do that, but as I noted earlier there had been an issue with REAL(16) variables in the debugger.
- Отметить как новое
- Закладка
- Подписаться
- Отключить
- Подписка на RSS-канал
- Выделить
- Печать
- Сообщить о недопустимом содержимом
garylscott wrote:Of possible (but remote) interest, here is an easy method of creating a shared memory buffer using file mapping, without need for a DLL. You can share across separate processes (you'll need your own synchronization method, not too hard to do), threads, DLLs, even separate machines with only minor tweaks and additional effort. This was written in ~1999 for DVF or CVF and may need some tweaks for IVF but that should be fairly minor. Overhead will average in the nanoseconds as this prevents page swapping as-is (can be easily changed).
http://www.fortranlib.com/ShareBufferWin32.f90
I could provide an update (IVF compatibility, modernize, etc.) if there's any interest.
Gary,
I am interested in a IVF update to the shared memory example you posted. Thanks in advance.

- Подписка на RSS-канал
- Отметить тему как новую
- Отметить тему как прочитанную
- Выполнить отслеживание данной Тема для текущего пользователя
- Закладка
- Подписаться
- Страница в формате печати
- « Предыдущий
-
- 1
- 2
- Следующий »