小编Ram*_*ish的帖子

在Delphi 2007中链接多个C对象文件时出错

我是delphi的新手.我试图在我的Delphi项目中添加C Object文件并直接链接它们,因为Delphi支持C Object Linking.当我链接单个Object文件时,我得到了它.但是当我尝试链接多个目标文件时,我收到错误"不满意的前向或外部声明".我在Delphi 2007以及XE中尝试过这个.所以我在这里做错了什么?

工作守则:

function a_function():Integer;cdecl;  

implementation  

{$Link 'a.obj'}  

function a_function():Integer;cdecl;external;  

end.
Run Code Online (Sandbox Code Playgroud)

错误代码:

function a_function():Integer;cdecl;  
function b_function();Integer;cdecl;  
function c_function();Integer;cdecl;  

implementation  

 {$LINK 'a.obj'}  
 {$LINK 'b.obj'}  
 {$LINK 'c.obj'}  

function a_function():Integer;cdecl;external;  
function b_function();Integer;cdecl;external;  
function c_function();Integer;cdecl;external;  
end.
Run Code Online (Sandbox Code Playgroud)

c delphi delphi-2007 object-files delphi-xe

5
推荐指数
1
解决办法
1281
查看次数

C函数指针转换成Delphi/Pascal?

我目前正在将一些C头文件转换为Delphi.我找不到将函数指针从C转换为Delphi的引用.

typedef _JAlloc JAlloc;  
struct _JAlloc {  
    void *(*alloc) (JAlloc *allocator, size_t size);  
    void (*free) (JAlloc *allocator, void *p);  
    void *(*realloc) (JAlloc *allocator, void *p, size_t size);  
};
Run Code Online (Sandbox Code Playgroud)
  1. Delphi的翻译是什么?

  2. 在哪里可以找到将C头手动转换为Delphi的良好资源(包括指针,预处理器指令等)?

c delphi pascal pointers function-pointers

5
推荐指数
1
解决办法
1906
查看次数

如何在Inno Setup的InputDirPage中显示/使用用户选择的应用程序路径{app}?

我正在使用Inno Setup创建一个安装程序.我必须从用户那里采取两条路径.一个用于程序可执行文件,另一个用于库.默认的app文件夹是{pf}/companyname/applicationname

InitializeWizard我创建了第二页,它从用户获取lib文件夹.

有没有办法将默认的lib文件夹更改为用户选择的文件夹{app}

我试过了WizardDirValue.它只提供默认{app}值,而不是用户在第一页中选择的路径.

[code]  
procedure InitializeWizard();  
begin  
  page2:= CreateInputDirPage(wpProgress,
    'Select Library Location', 'Where Library files should be stored?',
    'To continue, click Next. If you would like to select a different folder, click Browse.',
    False, 'Libs');    
  page2.Add('');  
  page2.Values[0] := WizardDirValue+'\libs';  
  LibDir := page2.Values[0];  
end
Run Code Online (Sandbox Code Playgroud)

installer pascal inno-setup

2
推荐指数
1
解决办法
8306
查看次数

用户列表中的循环单元引用是否可以在delphi中进行?


我正在将一些C头文件翻译成Delphi.
在这些头文件中,两个文件彼此共享它们的结构.
当我在Delphi中尝试这个时,它给了我循环引用错误.
所以我目前正在单个.pas文件中编写两个头文件的翻译.
有没有其他方法来解决这个问题?

这是一个小例子.
实际的头文件比较复杂:

== == File1.h

struct a
{
int data;
}
int compare(struct a,struct b);
Run Code Online (Sandbox Code Playgroud)

== == File2.h

struct b
{
int data;
}
int compare(struct A,struct b);
Run Code Online (Sandbox Code Playgroud)

== == File1.pas

uses File2;
type
  a = packed record
    data: Integer;
  end;

compare = function(d1: a; d2: b): Integer; cdecl;
Run Code Online (Sandbox Code Playgroud)

== == File2.pas

uses File1;
type
  b = packed record
    data: Integer;
  end;

compare = function(d1: a; d2: b): Integer; cdecl;
Run Code Online (Sandbox Code Playgroud)

c delphi

2
推荐指数
1
解决办法
1013
查看次数