Espero haber acertado con la sección, pues mi consulta tiene que ver tanto con DELPHI como con C++ BUILDER.
Se trata de una llamada a una función de una DLL; muestra una ventana con un objeto TListBox; si se pulsa el botón ACEPTAR la función devuelve TRUE y los valores contenidos en el objeto TListBox. Sin embargo la aplicación (en DELPHI) me devuelve la excepción EInvalidPointer.
CÓDIGO DE LA DLL (C++)
Código Delphi
[-]
extern "C" _declspec(dllexport) bool _stdcall SeleccionarValores(char *buffer);
bool _stdcall SeleccionarValores(char *buffer) } __finally return resultado; }
CÓDIGO DEL EXE (DELPHI)
Código Delphi
[-]
procedure TForm1.Button2Click(Sender: TObject);
type
TLlamarDLL = function(buffer : PChar):boolean;stdcall;
var
LlamarDLL : TLlamarDLL;
DLL : THandle;
buffer : pchar;
begin
DLL := LoadLibrary('LIBRERIA.DLL');
if DLL > 0 then
begin
@LlamarDLL := GetProcAddress(DLL, 'SeleccionarValores');
if not(@LlamarDLL = nil) then
begin
LlamarDLL(buffer);
ComboBox1.Items.SetText(buffer);
StrDispose(buffer);
end;
FreeLibrary(DLL);
end;
end;
¿Me podéis explicar dónde está el error?