You are not logged in.
Pages: 1
Hi Ab
I have managed to compile my sqlite3.c into 64 bit .o files. Now I'm trying to compile the Mormot sources into 64 bit dcus, but I'm running into trouble with SynCOmmonspas, regarding the SynLog rouytines.
This piece
var
/// internal list of created TSynLog instance, one per each log file on disk
// - do not use directly - necessary for inlining TSynLogFamily.SynLog method
SynLogFile: TObjectList = nil;
is required at many other places, but is inside a {$ifdef NOEXCEPTIONINTERCEPT} block, causing compilation failes at several places where the global SynLogFile is addressed like:
function TSynLogFamily.CreateSynLog: TSynLog;
var i: integer;
begin
if SynLogFile=nil then begin
SynLogFile := TObjectList.Create;
GarbageCollector.Add(SynLogFile);
end;
result := fSynLogClass.Create(self);
i := SynLogFile.Add(result);
if fPerThreadLog then
SynLogFileIndex[fIdent] := i+1 else
fGlobalLog := result;
end;
Is something wrong with the compiler defines or is it just me not understanding what needs to be done
(Using Delphi XE3)
Offline
Support of 64 bit compilation is not finished nor tested yet.
Latest version of SynCommons.pas should be more prepared for 64 bit compilation, since it includes RtlCaptureStackBackTrace() API calls to retrieve the stack trace.
I've committed some code fix with which setting NOEXCEPTIONINTERCEPT is compiling.
Not fully tested, though.
See http://synopse.info/fossil/info/d2bab10f61
If you can share your experiment with 64 bit SQLite3 linking, you are welcome!
Offline
I Moved the SYnLog definition outside defenitions and syncommons compiles well now.
Also I added USETYPEINFO define to x64 compilation
{$ifdef CPUX64}
{$define CPU64} // Delphi compiler for 64 bit CPU
{$undef CPU32}
{$define PUREPASCAL} // no x86 32 bit asm to be used
{$define USETYPEINFO} // in x64 we can onpy use official typeinfo structures
{$else}
Next I run into trouble with the next code. Do you think my code proposal is valid?
function TSQLPropInfoRTTI.GetFieldAddr(Instance: TObject): pointer;
begin
if Instance=nil then
result := nil else
{$ifndef USETYPEINFO} // inx64 we can onpy use official typeinfo structures
result := fPropInfo^.GetFieldAddr(Instance);
{$else}
begin
if NativeInt(fPropInfo^.GetProc)<0 then // high bit set: there is no getter method so it's an offset. (should work in x64 as well as x32)
begin
result:=Instance;
inc(PByte(Result),(integer(NativeInt(fPropInfo^.GetProc)) and $7fffffff)); add the offset to the object base pointer
end
else Result:=nil; // return nil for no pointer to data because there's a getter method
end
{$endif}
end;
Then again, this code could also be defined in the as a "pure pascal" routine...
{$ifndef USETYPEINFO}
function TPropInfo.GetFieldAddr(Instance: TObject): pointer;
asm
cmp [eax].TPropInfo.GetProc.Byte[3],$FF // is it a field property?
mov eax,[eax].TPropInfo.GetProc
jnz @0
// field - Getter is the field's offset in the instance data
and eax,$00FFFFFF
add eax,edx
ret
@0:xor eax,eax // method -> return nil
end;
{$endif}
I seem to get a little stuck now. Can I ask you to put some focus on the x64 compilation? If you need I can provide you with a RDP session or Teamviewer session. Just send me an email and we'll find out how.
Hans
Offline
Yes I am definitely willing to share. I'll keep you posted.
Offline
I've made some code refactoring, and now trunk includes several fixes for proper PUREPASCAL and USETYPEINFO conditional compilation (targetting 64 bit).
See http://synopse.info/fossil/info/9ff890c4a6
and http://synopse.info/fossil/info/db1f196673
This is a good start to work with in order to fulfill 64 bit compilation.
Offline
WOnderful. I'll keep you posted!
Offline
Pages: 1