Delphi XE2:如何在组件单元中不定义类函数的成员 [英] Delphi XE2: how to define not members of a class functions in the component unit
问题描述
我不是类函数的成员有问题。我想在新的组件单元中使用该功能,但它们在组件单元中不起作用!
I have problem with not members of a class functions. I want to use that functions in a new component unit but they did not work in a component unit!
这两个函数必须分配给dll中的另一个函数作为参数。
these two functions must assign to another function in a dll as parameter.
当我使用这两个函数时(不是类的成员)可以工作的主要形式,但是在新的组件单元中,dll函数无法再调用这两个函数!我该如何解决这个问题?这是delphi的bug吗?因为我使用的是Delphi XE Update 2,所以这是delphi的最新版本,也许是一个错误!
When I used this 2 functions(not members of class) in main form they can work but in the new component unit, the dll function cannot call back these two functions any more! How can I resolve this problem ? Is this delphi bug ? because I am using Delphi XE Update 2 this is lastest version of delphi maybe it is a bug!
TComp12 = class(TCustomPanel)
private
....
protected
....
public
....
end;
function function1(opaque: Pointer; plane: Pointer): Pointer; cdecl;
function function2(opaque: Pointer; picture: Pointer; plane: Pointer) : Pointer; cdecl;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('Comp1', [TComp12]);
end;
function function1(opaque: Pointer; plane: Pointer): Pointer; cdecl;
begin
......
end;
function function2(opaque: Pointer; picture: Pointer; plane: Pointer) : Pointer; cdecl;
begin
......
end;
推荐答案
我看着您的代码,它不是
I looked at your code, and it is not a bug in Delphi.
以下代码中有一个错误:
There is a bug in the following code:
function VLCLock(opaque: Pointer; plane: Pointer): Pointer; cdecl;
var
ctx: TCTX;
begin
ctx := TCTX(opaque);
Pointer(plane^) := @(ctx.FBuffer.StartLine[0]);
Result := nil;
end;
TCTX(不透明)
应该为 TCTX(opaque ^)
。您必须在代码中修复所有类似的情况。
TCTX(opaque)
should be TCTX(opaque^)
. You must fix all similar occurrences in your code.
这篇关于Delphi XE2:如何在组件单元中不定义类函数的成员的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!