Answer the question
In order to leave comments, you need to log in
How to implement the export of functions from a C library in Delphi with an explicit DLL connection?
Greetings, comrades. I ask you not to rot me for using Delphi, but just to help a little.
The libcurl library has a function:
CURLcode curl_easy_setopt(CURL *curl, CURLoption option, parameter);
function CURLEasySetOption
(
Handle: PCURLHandle;
Option: TCURLOption
): TCURLCode; varargs; cdecl; external 'libcurl.dll' name 'curl_easy_setopt';
var
CURLEasySetOption: function
(
Handle: PCURLHandle;
Option: TCURLOption;
Parameter: Integer
): TCURLCode; cdecl;
implementation
CURLEasySetOption := GetProcAddress(DLLHandle, AnsiString('curl_easy_setopt'));
function CURLEasySetOption
(
Handle: PCURLHandle;
Option: TCURLOption;
Parameter: Integer
): TCURLCode; overload;
function CURLEasySetOption
(
Handle: PCURLHandle;
Option: TCURLOption;
Parameter: Boolean
): TCURLCode; overload;
function CURLEasySetOption
(
Handle: PCURLHandle;
Option: TCURLOption;
Parameter: Pointer
): TCURLCode; overload;
var
CURLEasySetOptionExternal: function
(
Handle: PCURLHandle;
Option: TCURLOption;
Parameter: Integer
): TCURLCode; cdecl;
implementation
function CURLEasySetOption
(
Handle: PCURLHandle;
Option: TCURLOption;
Parameter: Integer
): TCURLCode;
begin
Result := CURLEasySetOptionExternal(Handle, Option, Parameter);
end;
function CURLEasySetOption
(
Handle: PCURLHandle;
Option: TCURLOption;
Parameter: Boolean
): TCURLCode;
begin
Result := CURLEasySetOptionExternal(Handle, Option, Integer(Parameter));
end;
function CURLEasySetOption
(
Handle: PCURLHandle;
Option: TCURLOption;
Parameter: Pointer
): TCURLCode;
begin
Result := CURLEasySetOptionExternal(Handle, Option, Integer(Parameter));
end;
...
CURLEasySetOptionExternal := GetProcAddress(DLLHandle, AnsiString('curl_easy_setopt'));
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question