Ver Mensaje Individual
  #1  
Antiguo 16-06-2013
webmasterplc webmasterplc is offline
Miembro
 
Registrado: mar 2008
Posts: 275
Reputación: 17
webmasterplc Va por buen camino
Error al Llamar Función en DLL (Interface not suported).

Buenas, estoy escribiendo una función para enviar datos post a un gateway de sms, ya hice la función y todo perfecto, pero ahora me gustaría tenerla en dll la paso a dll pero me dice Interface Not Suported, aqui dejo el codigo de la dll y la llamada.

Codigo DLL.

Código Delphi [-]
library sms;

{ 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,
  IdHTTP;

{$R *.res}
function enviarSMS (url,usuario,clave,phone,mensaje : string) : string; export
var
  http: TIdHttp;
  params: TStrings;
  respuesta: string;
begin
    http := TIdHTTP.Create(nil);
    params := TStringList.Create;

    begin
        params.Add('usuario='+usuario);
        params.Add('clave='+clave);
        params.Add('telefonos='+phone);
        params.Add('texto='+mensaje);
        respuesta := http.Post(url, params);
    end;
    params.Free;
    http.Free;
end;
end.

este es el de la llamada

Código Delphi [-]
var
Form1: TForm1;
function enviarSMS (url,usuario,clave,phone,mensaje : string) : string; stdcall external'sms.dll';
implementation

{$R *.dfm}

procedure TForm1.btn1Click(Sender: TObject);
begin
enviarSMS(edt1.Text,edt2.Text,edt3.Text,edt4.Text,edt5.Text);
edt4.Clear;
edt5.Clear;
end;
Responder Con Cita