请问 delphi 生成的 obj 文件如何能被 delphi 自己调用?(100分)

  • 主题发起人 主题发起人 白河愁
  • 开始时间 开始时间

白河愁

Unregistered / Unconfirmed
GUEST, unregistred user!
无论是在 link output 中或者是直接用 dcc32 -j 111.pas 编译出的 obj,
用delphi调用 {$L 111.obj} 编译都出现 16-Bit fixup encountered in object file 'xxx.obj' 中,请问如何解决?
 
好象不行,一般Delphi 调用时用DCU,
OBJ只是对C++的OBJ的。
 
但 delphi 自己本身就可以生成 c或者c++ 的obj,
而且使用其它语言生成的 obj 也是可以的.
 
可参考一下TPerlRegEx源码,它就使用了c++生成的obj
有空我也看看,这个问题很有趣的
 
// If we are not allowed to use a DLL, we will link the OBJ files C++Builder 3.0 generates while building the DLL
// directly into our Pascal unit.

{$L pcre/maketables.obj}
{$L pcre/study.obj}
{$L pcre/pcre.obj}
{$L pcre/get.obj}
function _pcre_maketables: PAnsiChar
cdecl
external;
function _pcre_compile(const pattern: PChar
options: Integer
errorptr: PPChar
erroroffset: PInt;
const tables: PChar): Pointer
cdecl
external;
function _pcre_exec(const pattern: Pointer
const hints: Pointer
const subject: PChar;
length, startoffset, options: Integer
offsets: PInt
offsetcount: Integer): Integer
cdecl
external;
function _pcre_get_stringnumber(const pattern: Pointer
const Name: PChar): Integer
cdecl
external;
function _pcre_study(const pattern: Pointer
options: Integer
errorptr: PPChar): Pointer
cdecl
external;
function _pcre_fullinfo(const pattern: Pointer
const hints: Pointer
what: Integer
where: Pointer): Integer
cdecl
external;
function _pcre_version: pchar
cdecl
external;
procedure _pcre_dispose(pattern, hints, chartable: Pointer)
cdecl
external;

// These functions are required by pcre.obj and study.obj
// Unlike the DLL, this unit is not being linked agains the standard C libraries, so we have to provide them ourselves
{$I CHELPERS.PAS}

看了下使用的是CBC编译的obj文件
 
把一个pas改成
program TestObj;

function TestObjTest(a, b: Integer): integer
export;
begin
Result := a + b;
end;

end.
就没有16-Bit fixup encountered in object file 这样的错误,但有了些别的
[Error] MyObjTestUnit.pas(30): Unsatisfied forward or external declaration: '@Sysinit@Finalization$qqrv'
[Error] MyObjTestUnit.pas(30): Unsatisfied forward or external declaration: '@Sysinit@@InitExe$qqrpv'
[Error] MyObjTestUnit.pas(30): Unsatisfied forward or external declaration: '@Sysinit@initialization$qqrv'
[Error] MyObjTestUnit.pas(30): Unsatisfied forward or external declaration: '@System@@HandleFinally$qqrv'
[Error] MyObjTestUnit.pas(30): Unsatisfied forward or external declaration: '@System@Finalization$qqrv'
[Error] MyObjTestUnit.pas(30): Unsatisfied forward or external declaration: '@System@@Halt0$qqrv'
[Error] MyObjTestUnit.pas(30): Unsatisfied forward or external declaration: '@System@initialization$qqrv'
 
很奇怪,delpi反而不能用自己生成的obj???
 
后退
顶部