Пересобираю UDF написанную на Delphi, собирается нормально,
а при использовании возвращается сообщение об ошибке, что функция не найдена.
Как побороть?
			
		Модератор: Модераторы

 
 library StageUDF;
{$ALIGN OFF}
{$mode objfpc}
{$smartlink off}
{$PACKRECORDS C}
uses
  StageLibrary in 'StageLibrary.pas'
  { add your units here };
exports
  ServerDate name 'ServerDate';
begin
end. 
unit StageLibrary;
{$mode objfpc}{$H+}
interface
uses
  Classes, SysUtils;
type
  PIBDateTime = ^TIBDateTime;
  TIBDateTime = record
    Days,                           // Date: Days since 17 November 1858
    MSec10 : Integer;               // Time: Millisecond * 10 since midnigth
  end;
function ToDelphiDate(const aIBDateTime: TIBDateTime): TDateTime;
function ServerDate(var ServerIBDateTime: TIBDateTime): PIBDateTime; cdecl; export;
implementation
const                               // Date translation constants
  MSecsPerDay10 = MSecsPerDay * 10; // Milliseconds per day * 10
  IBDateDelta = 15018;              // Days between Delphi and InterBase dates
function ToDelphiDate(const aIBDateTime: TIBDateTime): TDateTime;
begin
  with aIBDateTime do
    Result := Days - IBDateDelta + MSec10 / MSecsPerDay10;
end;
function ServerDate(var ServerIBDateTime: TIBDateTime): PIBDateTime; cdecl; export;
var
  DelphyDays : Integer;
begin
  DelphyDays := Trunc(Now);
  with ServerIBDateTime do begin
    Days := DelphyDays + IBDateDelta;
    MSec10 := Trunc((Now - DelphyDays) * MSecsPerDay10);
  end;
  Result := @ServerIBDateTime;
end;
end.                              
 
 declare external function fp_serverdate
  date
returns
  date
entry_point "ServerDate"
module_name "StageUDF";

Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 1