Главная страница
    Top.Mail.Ru    Яндекс.Метрика
Форум: "Основная";
Текущий архив: 2004.10.10;
Скачать: [xml.tar.bz2];

Вниз

dll dynamik link   Найти похожие ветки 

 
Newad   (2004-09-22 00:57) [0]

проблема с динамич использованием

var
PRO:procedure(t:integer);
begin

d:=LoadLirary(...

PRO:=GetProcAddress(d,PCHAR(LongInt(1)));
PRO(456); =выдает ошибку Access violation с чего бы это?


 
Defunct ©   (2004-09-22 01:10) [1]

первое:

PRO:procedure(t:integer); stdcall/cdecl;

> PRO(456); =выдает ошибку Access violation с чего бы это?

PRO = nil, в dll нет функции с именем
HEX 00 00 00 01 00

FARPROC GetProcAddress(

   HMODULE hModule, // handle to DLL module  
   LPCSTR lpProcName  // name of function
  );


 
GuAV ©   (2004-09-22 01:43) [2]


> первое:
>
> PRO:procedure(t:integer); stdcall/cdecl;

не-а, не обязательно.


 
Defunct ©   (2004-09-22 02:55) [3]

> не-а, не обязательно.

Что не обязательно? ОБЯЗАТЕЛЬНО проверить и использовать одинаковое соглашение о вызове в DLL и в приложении, которое использует ресурсы DLL.


 
Newad   (2004-09-22 10:58) [4]

в длл обьявлено так
procedure ists(t:integer);
begin

end;

export
ists index 1,
....


 
-SeM-   (2004-09-22 11:18) [5]

type TPRO = procedure(t: Integer);

var
 PRO: TPRO;


 
VMcL ©   (2004-09-22 11:19) [6]

>>Defunct ©  (22.09.04 01:10) [1]

Причем здесь имя? Он типа по номеру импортировать хочет, насколько понял. Только непонятно, зачем. Лучше по имени.

GetProcAddress

The GetProcAddress function retrieves the address of an exported function or variable from the specified dynamic-link library (DLL).

FARPROC GetProcAddress(
 HMODULE hModule,
 LPCSTR lpProcName
);

...

Remarks
The spelling and case of a function name pointed to by lpProcName must be identical to that in the EXPORTS statement of the source DLL"s module-definition (.def) file. The exported names of functions may differ from the names you use when calling these functions in your code. This difference is hidden by macros used in the SDK header files. For more information, see Conventions for Function Prototypes.

The lpProcName parameter can identify the DLL function by specifying an ordinal value associated with the function in the EXPORTS statement. GetProcAddress verifies that the specified ordinal is in the range 1 through the highest ordinal value exported in the .def file. The function then uses the ordinal as an index to read the function"s address from a function table. If the .def file does not number the functions consecutively from 1 to N (where N is the number of exported functions), an error can occur where GetProcAddress returns an invalid, non-NULL address, even though there is no function with the specified ordinal.

In cases where the function may not exist, the function should be specified by name rather than by ordinal value.


 
GuAV ©   (2004-09-22 14:22) [7]


> Что не обязательно? ОБЯЗАТЕЛЬНО проверить и использовать
> одинаковое соглашение о вызове в DLL и в приложении, которое
> использует ресурсы DLL.

Да, но чтоб оно было cdecl или stdcall - не обязательно, resgiter тоже работает.



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

Форум: "Основная";
Текущий архив: 2004.10.10;
Скачать: [xml.tar.bz2];

Наверх





Память: 0.46 MB
Время: 0.033 c
14-1095433830
Soft
2004-09-17 19:10
2004.10.10
Обнаженные новости


1-1096286363
TActionManager
2004-09-27 15:59
2004.10.10
Как создать свой пункт меню первого уровня


4-1094794580
needle
2004-09-10 09:36
2004.10.10
Как узнать принадлежит-ли компьютер к какому-либо домену?


1-1095946842
jonik
2004-09-23 17:40
2004.10.10
Компонент TdxMemData необходимо установить фильтр


6-1091270209
Боян Георгиев
2004-07-31 14:36
2004.10.10
Incorrect authentication data





Afrikaans Albanian Arabic Armenian Azerbaijani Basque Belarusian Bulgarian Catalan Chinese (Simplified) Chinese (Traditional) Croatian Czech Danish Dutch English Estonian Filipino Finnish French
Galician Georgian German Greek Haitian Creole Hebrew Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian
Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Thai Turkish Ukrainian Urdu Vietnamese Welsh Yiddish Bengali Bosnian
Cebuano Esperanto Gujarati Hausa Hmong Igbo Javanese Kannada Khmer Lao Latin Maori Marathi Mongolian Nepali Punjabi Somali Tamil Telugu Yoruba
Zulu
Английский Французский Немецкий Итальянский Португальский Русский Испанский