powered by simpleCommunicator - 2.0.60     © 2026 Programmizd 02
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Форумы / Sybase ASA, ASE, IQ [игнор отключен] [закрыт для гостей] / External procedure и Delphi
3 сообщений из 3, страница 1 из 1
External procedure и Delphi
    #34589453
Mr.DKSoft
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
Уважаемые гуру!
Пітаюсь написать external procedure реализующую ф-ции заданной криптобиблиотеки. Пишу на Delphi. Как указано в примере в каталоге External procedure лучший способ использовать структуры
typedef struct an_extfn_value
и
typedef struct an_extfn_api
и возникла проблема перевода typedef struct an_extfn_api на Delphi
Код: plaintext
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
typedef struct an_extfn_api {
    // arg_handle = a handle to arguments provided by the server
    // arg_num    = argument number  0 ..N,  0 =return value
    // data       = pointer to arg data
    
    // Calling get_value on an OUT argument will simply return the data type
    // of the argument, and will return data as NULL.

    // Must call get_value before get_piece.

    short (SQL_CALLBACK *get_value)(
				    void *          arg_handle,
				    a_sql_uint32    arg_num,
				    an_extfn_value *value
				    );
    short (SQL_CALLBACK *get_piece)(
				    void *          arg_handle,
				    a_sql_uint32    arg_num,
				    an_extfn_value *value,
				    a_sql_uint32    offset
				    );

    // To return a null value, set "data" to NULL in an_extfn_value.
    // The total_len field is ignored on calls to set_value, the data supplied
    // becomes the value of the argument if append is FALSE; otherwise the
    // data is appended to the current value of the argument. It is expected
    // that set_value will be called with append=FALSE for an argument before
    // being called with append=TRUE for the same argument.
    // The append field is ignored for fixed length data types (i.e., all 
    // numeric data types)

    short (SQL_CALLBACK *set_value)(
				    void *          arg_handle,
				    a_sql_uint32    arg_num,
				    an_extfn_value *value,
				    short	    append
				    );
    // The external function should call the following
    // if it expects the server to pass on any interrupts.
    // The cancel_handle will be passed back into the
    // DLL by the server on the extfn_cancel call below 
    void (SQL_CALLBACK *set_cancel)(
				    void *	arg_handle,
				    void *	cancel_handle
				    );
} an_extfn_api;

как я понимаю в понятиях Delphi это класс
и возникла проблема перевода typedef struct an_extfn_api на Delphi
Код: plaintext
1.
2.
3.
4.
5.
6.
an_extfn_api = class
   function  get_value(arg_handle : pointer;
                              arg_num    : integer;
                              value        : an_extfn_value):smallint;    
......................    
end;
а как описать get_value
или что я делаю не так
Спасибо за ваши ответы
...
Рейтинг: 0 / 0
External procedure и Delphi
    #34589958
White Owl
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Mr.DKSoftкак я понимаю в понятиях Delphi это класс Структура в C это Record в Delphi.
А в дальнейшем с вопросами перевода с С на Дельфи иди на Дельфевый форум.
...
Рейтинг: 0 / 0
External procedure и Delphi
    #34614227
Фотография MasterZiv
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
Mr.DKSoft пишет:
> Пітаюсь написать external procedure реализующую ф-ции заданной
> криптобиблиотеки. Пишу на Delphi. Как указано в примере в каталоге
> External procedure лучший способ использовать структуры

Сомневаюсь, что получится написать это на Дельфи, дело в том,
что все библиотеки для ASE - в формате для MSVC. А у Дельфы
какие-то проблемы с их пониманием. Вроде бы и можно как-то,
но уж больно сложно все. Но это понятное дело не сюда.
А (SQL_CALLBACK *get_piece) и т.п. - это не класс, это в структуре
обявлены мемберы-указатели на функции.
Posted via ActualForum NNTP Server 1.4
...
Рейтинг: 0 / 0
3 сообщений из 3, страница 1 из 1
Форумы / Sybase ASA, ASE, IQ [игнор отключен] [закрыт для гостей] / External procedure и Delphi
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]