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

Вниз

Что написано в DLL неверно???   Найти похожие ветки 

 
Volf_555   (2006-02-14 21:57) [0]

Вот мой код DLL:
library Project1;

{ Important note about DLL memory management: ShareMem must be the
 first unit in your library"s USES clause AND your project"s (select
 Project-View Source) USES clause if your DLL exports any procedures or
 functions that pass strings as parameters or function results. This
 applies to all strings passed to and from your DLL--even those that
 are nested in records and classes. ShareMem is the interface unit to
 the BORLNDMM.DLL shared memory manager, which must be deployed along
 with your DLL. To avoid using BORLNDMM.DLL, pass string information
 using PChar or ShortString parameters. }

uses
 SysUtils,
 Classes;

{$R *.res}

function MyFact(s:Integer):Integer; stdcall;
var
a:Integer;
res:Integer;
begin
if s=0 then
 res:=1 else
if s>0 then
 for a:=1 to s do
  res:=res*a else
if s<0 then
begin
 for a:=1 to abs(s) do
  res:=res*a;
 res:=res*-1;
end;
result:=res;
end;

function MyStep(chislo:Integer;stepen:Integer):Integer; stdcall;
var
a:Integer;
res:Integer;
begin
res:=1;
if stepen>0 then
begin
 for a:=1 to stepen do
  res:=res*chislo;
end else
if stepen<0 then
begin
 for a:=1 to abs(stepen) do
  res:=res*chislo;
 res:=1 div res;
end else
if stepen=0 then
 res:=1;

result:=res;
end;

exports
function MyFact;
function MyStep;

begin

end.


При компиляции выскакивает ошибка:
[Error] Project1.dpr(62): Identifier expected but "FUNCTION" found
[Error] Project1.dpr(62): Function needs result type


Что в моей DLL неверно?!


 
begin...end ©   (2006-02-14 22:03) [1]

> Volf_555   (14.02.06 21:57)

> exports
> function MyFact;
> function MyStep;

exports
 MyFact, MyStep;


 
kaZaNoVa ©   (2006-02-14 22:04) [2]

....

exports  MyFact, MyStep;

begin

end.


 
Volf_555   (2006-02-14 22:08) [3]

Точно! Спасибо :)


 
evvcom ©   (2006-02-15 09:05) [4]


> begin
> if s=0 then
>  res:=1 else
> if s>0 then
>  for a:=1 to s do
>   res:=res*a else

А вот на Warning "Variable "res" might not have been initialized" стоит обратить внимание!


 
AbrosimovA   (2006-02-16 11:46) [5]

Зачем вводить промежуточную переменную res, если можно использовать Result, например:
function MyFact(s:Integer):Integer; stdcall;
var
a:Integer;
begin
Result:=1;
if s>0 then
for a:=1 to s do
 Result:=Result*a;
if s<0 then
begin
for a:=1 to abs(s) do
 Result:=Result*a;
Result:=Result*-1;
end;
end;



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

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

Наверх




Память: 0.46 MB
Время: 0.011 c
10-1114854261
zafar
2005-04-30 13:44
2006.03.05
Как выделить часть или весь документ....


15-1139553043
Rouse_
2006-02-10 09:30
2006.03.05
Ну вот собственно и фсе. Сегодня у меня свадьба :)


10-1089475597
mishka
2004-07-10 20:06
2006.03.05
mathcad и delphi - передача и возврат переменных?


3-1136450830
sally
2006-01-05 11:47
2006.03.05
Увеличение скорости обработки данных


1-1138610482
rolex
2006-01-30 11:41
2006.03.05
Как избавиться в ListView от мерцания при прокрутке?





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
Английский Французский Немецкий Итальянский Португальский Русский Испанский