Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2004.10.24;
Скачать: CL | DM;

Вниз

Создать секцию для общедоступных переменных   Найти похожие ветки 

 
DelphiLexx ©   (2004-10-08 19:21) [0]

С++ позволяет создвать переменные в общедоступном блоке памяти:

#pragma data_seg("Shared")
HHOOK g_hhook = NULL;
#pragma data_seg()
#pragma comment(linker, "/Section:Shared,rws")

Вопрос: Как сделать аналогичное на Delphi, без использования
CreateFileMapping.
Я долго заморачивался по поводу того, чтобы данный код на с++ перевести на анологичное на Delphi. У всех у кого я спрашивал отвечали, что сделать подобное на Delphi нельзя (т.е. нельзя создать общедоступный блок переменных) . Но ведь можно сделать на ассемблере(я узнал, что на асме можно создать общедоступный блок переменных) и код асмы вставить в delphi. Вопрос как аналогичный код на C++ на писать на assembler"e и вставить его в Delphi?!


 
Fenik   (2004-10-08 19:39) [1]

Глобальные переменные?


 
Cobalt ©   (2004-10-08 21:49) [2]

Это должен поддерживать линковщик, кажется.
Хотя, попробуй
Link object file

Type Parameter
Syntax {$L filename}
{$LINK filename}
Scope Local
Remarks

The $L parameter instructs the compiler to link the named file with the program or unit being compiled. The $L directive is used to link with code written in other languages for procedures and functions declared to be external. The named file must be an Intel relocatable object file (.OBJ file). The default extension for filename is .OBJ. If filename does not specify a directory path, then, in addition to searching for the file in the same directory as the current module, Delphi searches in the directories specified in the Search path input box on the Directories/Conditionals page of the Project|Options dialog box (or in the directories specified in the -O option on the DCC32 command line).

To specify a file name that includes a space, surround the file name with single quotation marks: {$L "My file"}.
For further details about linking with assembly language, see online Help.


 
Игорь Шевченко ©   (2004-10-08 23:45) [3]


> Вопрос: Как сделать аналогичное на Delphi, без использования
> CreateFileMapping.


Искать на Borland Community статью how to make shared section. Автор - кто-то из маститых, может быть, Petr Vones, может, я ошибаюсь.


 
programania ©   (2004-10-09 01:32) [4]

Отдельный Unit c обьялениями
включить в uses всех других unitов



Страницы: 1 вся ветка

Текущий архив: 2004.10.24;
Скачать: CL | DM;

Наверх




Память: 0.47 MB
Время: 0.025 c
9-1088280771
ALexb
2004-06-27 00:12
2004.10.24
delphix


1-1097563355
Ann_k
2004-10-12 10:42
2004.10.24
Процедуры в datamodule


1-1096554966
Devel
2004-09-30 18:36
2004.10.24
AV при использовании TXMLDocument


1-1097579536
Maze
2004-10-12 15:12
2004.10.24
OnDrawItem of TListView


3-1096141609
Вадим
2004-09-25 23:46
2004.10.24
Сумма времени