哪位帮忙把这个c的申代码抓成delphi6或delphi7的吗

jouky 2018-07-01 11:28:02
typedef struct temp_auth_configure
{
long long int expires;
void (* temp_auth_callback)(char * temp_auth_url,char * temp_auth_headers,void *callback_data);
void * callback_data;
}temp_auth_configure;

typedef struct obs_options
{
obs_bucket_context bucket_options;
obs_http_request_option request_options;
temp_auth_configure *temp_auth;
} obs_options;

主要是第三个 temp_auth_configure *temp_auth; 不知道怎么搞;
申明了一下,传入动态库出错
...全文
358 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
jzhong1234 2020-01-15
  • 打赏
  • 举报
回复
libeSDKOBS.dll能发上来吗?
qq_24797353 2018-07-03
  • 打赏
  • 举报
回复
到哪一步错了呢?是编译通过,执行纠错呢?还是点按钮错呢?
  • 打赏
  • 举报
回复
pProcedure=procedure (tempAuthUrl:pchar;tempAuthActualHeaders:pchar;callbackData:Pointer); cdecl;
jouky 2018-07-01
  • 打赏
  • 举报
回复
执行时提示内存访问错误;
jouky 2018-07-01
  • 打赏
  • 举报
回复
我用delphi7尝试的代码如下:

unit Unit1;

interface

uses
SysUtils, Types, Classes, Variants, QTypes, QGraphics, QControls, QForms,
QDialogs, QStdCtrls, QButtons,EncdDecd,IdSSLOpenSSL, IdBaseComponent,
IdComponent, IdTCPConnection, IdTCPClient, IdHTTP, xmldom, XMLIntf,
msxmldom, XMLDoc, Sockets, DBWeb, HTTPApp, HTTPProd,superobject,IdMultipartFormData;

const
DLL_HW = 'libeSDKOBS.dll';

type
obs_bucket_context = record
host_name:pchar;
bucket_name:pchar;
protocol:integer;
uri_style:integer;
access_key:pchar;
secret_access_key:pchar;
certificate_info:pchar;
storage_class:integer;
token:pchar;
end;


obs_http_request_option=record
speed_limit:integer;
speed_time:integer;
connect_time:integer;
max_connected_time:integer;
proxy_host:pchar;
proxy_auth:pchar;
ssl_cipher_list:pchar;
end;

pProcedure=procedure (tempAuthUrl:pchar;tempAuthActualHeaders:pchar;callbackData:Pointer);

temp_auth_configure=record
expires:longint;
temp_auth_callback:pProcedure;
callback_data:pointer;
end;

ptemp_auth_configure=^temp_auth_configure;


obs_options = record
bucket_options:obs_bucket_context;
request_options:obs_http_request_option;
temp_auth:ptemp_auth_configure;
end;

pobs_options=^obs_options;



TForm1 = class(TForm)
MS: TMemo;
MR: TMemo;
Button1: TButton;
BitBtn1: TBitBtn;
IdHTTP1: TIdHTTP;
BitBtn2: TBitBtn;
BitBtn3: TBitBtn;

procedure BitBtn3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;
option:pobs_options;


//华为云

procedure init_obs_options(options:pobs_options);stdcall;external DLL_HW name 'init_obs_options';
//华为云over

implementation



{$R *.xfm}



procedure TForm1.BitBtn3Click(Sender: TObject);
begin
GetMem(option, SizeOf(obs_options));

init_obs_options(option);
end;
jouky 2018-07-01
  • 打赏
  • 举报
回复
头文件里的申明
typedef struct obs_bucket_context
{
char *host_name;
char *bucket_name;
obs_protocol protocol;
obs_uri_style uri_style;
char *access_key;
char *secret_access_key;
char *certificate_info;
obs_storage_class storage_class;
char * token;
} obs_bucket_context;

typedef struct obs_http_request_option
{
int speed_limit;
int speed_time;
int connect_time;
int max_connected_time;
char *proxy_host;
char *proxy_auth;
char *ssl_cipher_list;
} obs_http_request_option;

typedef struct temp_auth_configure
{
long long int expires;
void (* temp_auth_callback)(char * temp_auth_url,char * temp_auth_headers,void *callback_data);
void * callback_data;
}temp_auth_configure;

typedef struct obs_options
{
obs_bucket_context bucket_options;
obs_http_request_option request_options;
temp_auth_configure *temp_auth;
} obs_options;


c程序的执行代码就是这样如下


obs_options option;
init_obs_options(&option);

1,184

社区成员

发帖
与我相关
我的任务
社区描述
Delphi Windows SDK/API
社区管理员
  • Windows SDK/API社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧