05 Dez 2013 16:09
library vetor;
uses
System.SysUtils,
System.Classes,
Vcl.Dialogs;
type
TArrayofString = array of string;
// TArrayofString = array[1..100] of string;
{$R *.res}
procedure AVetor(pVetor: TArrayofString; Colunas: Byte); stdcall; export;
var
I: Byte;
Tamanho: Byte;
begin
SetLength(pVetor, Colunas);
for I := 1 to Colunas do
showmessage(pVetor[I]);
end;
exports
AVetor;
begin
end.
unit uTesteVetor;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.Buttons;
type
TfrmTesteVetor = class(TForm)
btnTestar: TBitBtn;
procedure btnTestarClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
type
TArrayofString = array of string;
var
frmTesteVetor: TfrmTesteVetor;
implementation
{$R *.dfm}
procedure AVetor(pVetor: TArrayofString; Colunas: Byte); stdcall; external 'vetor.dll';
procedure TfrmTesteVetor.btnTestarClick(Sender: TObject);
var
loVetor: TArrayofString;
begin
SetLength(loVetor, 3);
loVetor[1] := 'Coluna 1';
loVetor[2] := 'Coluna 2';
loVetor[3] := 'Coluna 3';
AVetor(loVetor, 3);
ShowMessage('Fim.');
Close;
end;
end.
func main()
aviso("Entrou",0)
NDLL_pro := LoadLibrary("vetor.dll")
clear
mretorno = space(20)
declare vetor[255]
vetor[1]="MARCOS"
VETOR[2]="MAURO"
VETOR[3]="RAFAEL"
MITENS=3
mret_dll := DLLCALL(NDLL_pro, 32, "AVetor", mretorno, vetor, MITENS)
01 Jan 2014 21:48