PDA

View Full Version : Freepascal SVN trunk build problems



tux
14-07-2006, 08:52 PM
When trying to build my library under freepascal 2.1.1 i get the following error:

rpExposedMaterial.pas(20,1) Warning: Use of unsupported feature!
rpExposedMaterial.pas(20,1) Fatal: Syntax error, "BEGIN" expected but "EXPORTS" found


with this code



unit rpExposedMaterial;

interface

uses
libNewtonImport, RageExposedTypes, VectorTypes, VectorGeometry, RagePhysicsHeader;

implementation

procedure rpMaterialSetContactTangentDirection(aMaterial: PrpMaterial; aDirection: TVector3f); stdcall;
begin
NewtonMaterialContactRotateTangentDirections(PNewt onMaterial(aMaterial), @aDirection[0]);
end;

procedure rpMaterialSetContactTangentAcceleration(aMaterial: PrpMaterial; aAcceleration: Single; aIndex: Integer); stdcall;
begin
NewtonMaterialSetContactTangentAcceleration(PNewto nMaterial(aMaterial), aAcceleration, aIndex);
end;

exports

rpMaterialSetContactTangentDirection, rpMaterialSetContactTangentAcceleration;

end.


Surely creating libraries isnt unsupported?

paul_nicholls
14-07-2006, 10:42 PM
When trying to build my library under freepascal 2.1.1 i get the following error:

rpExposedMaterial.pas(20,1) Warning: Use of unsupported feature!
rpExposedMaterial.pas(20,1) Fatal: Syntax error, "BEGIN" expected but "EXPORTS" found


with this code



unit rpExposedMaterial;

interface

uses
libNewtonImport, RageExposedTypes, VectorTypes, VectorGeometry, RagePhysicsHeader;

implementation

procedure rpMaterialSetContactTangentDirection(aMaterial: PrpMaterial; aDirection: TVector3f); stdcall;
begin
NewtonMaterialContactRotateTangentDirections(PNewt onMaterial(aMaterial), @aDirection[0]);
end;

procedure rpMaterialSetContactTangentAcceleration(aMaterial: PrpMaterial; aAcceleration: Single; aIndex: Integer); stdcall;
begin
NewtonMaterialSetContactTangentAcceleration(PNewto nMaterial(aMaterial), aAcceleration, aIndex);
end;

exports

rpMaterialSetContactTangentDirection, rpMaterialSetContactTangentAcceleration;

end.


Surely creating libraries isnt unsupported?

When you are using stdcall and Exports, I assume you are trying to write a DLL :-)

Here is an example of creating a DLL (at least under Delphi)


library MinMax;
function Min(X, Y: Integer): Integer; stdcall;

begin
if X < Y then Min &#58;= X else Min &#58;= Y;
end;

function Max&#40;X, Y&#58; Integer&#41;&#58; Integer; stdcall;

begin
if X > Y then Max &#58;= X else Max &#58;= Y;
end;

exports

Min,
Max;

begin

end.

I believe you should be using Library instead of Unit and you forgot the Begin right before the final End.

I hope this helps,
Paul.

tux
15-07-2006, 07:52 AM
sorry, this is a unit. the main library file has a uses that links to the export units.

so stdcall and exports is only for windows? what about osx?

dmantione
15-07-2006, 01:13 PM
A unit cannot contain an exports section. Afaik you can export procedures inside units from the library file.

tux
15-07-2006, 02:32 PM
hmm. delphi copes fine...

the dpr contains the uses to the export units and the units contain the procedures / exports. makes it easier to update across multiple platforms (just update the uses instead of the uses and exports)

and aparently my code compiles fine with lazarus in windows

tux
16-07-2006, 06:04 PM
So i fixed all the code problems but FPC still doesnt want to build my project.

this is the output from xterm


TCompiler.Compile WorkingDir="/Users/jon/Documents/Development/Rage-Engine/Rage3D/Exposed/RagePhysicsLib/" CompilerFilename="/usr/local/bin/ppc386" CompilerParams=" -S2cdgi -O2 -TDarwin -Pi386 -gl -vewnhi -l -Fu../../RagePhysics/ -Fu../../Library/ -Fu../../RagePhysics/Joints/ -Fu../../RagePhysics/Libraries/ -Fu../ -Fu. -FU../../DCU/ -o../../DCU/RagePhysics.dylib RagePhysics.dpr"
&#91;TCompiler.Compile&#93; CmdLine="/usr/local/bin/ppc386 -S2cdgi -O2 -TDarwin -Pi386 -gl -vewnhi -l -Fu../../RagePhysics/ -Fu../../Library/ -Fu../../RagePhysics/Joints/ -Fu../../RagePhysics/Libraries/ -Fu../ -Fu. -FU../../DCU/ -o../../DCU/RagePhysics.dylib RagePhysics.dpr"
Hint&#58; Start of reading config file /etc/fpc.cfg
Hint&#58; End of reading config file /etc/fpc.cfg
Free Pascal Compiler version 2.1.1 &#91;2006/07/14&#93; for i386
Copyright &#40;c&#41; 1993-2006 by Florian Klaempfl
Target OS&#58; Darwin for i386
Compiling RagePhysics.dpr
RagePhysics.dpr&#40;4,50&#41; Hint&#58; Unit "RagePhysicsHeader" not used in RagePhysics
RagePhysics.dpr&#40;5,45&#41; Hint&#58; Unit "rpWorld" not used in RagePhysics
RagePhysics.dpr&#40;6,43&#41; Hint&#58; Unit "rpBody" not used in RagePhysics
RagePhysics.dpr&#40;7,60&#41; Hint&#58; Unit "rpJointBase" not used in RagePhysics
RagePhysics.dpr&#40;8,62&#41; Hint&#58; Unit "rpJointHinge" not used in RagePhysics
RagePhysics.dpr&#40;14,49&#41; Hint&#58; Unit "rpVehicle" not used in RagePhysics
RagePhysics.dpr&#40;16,53&#41; Hint&#58; Unit "rpCallbacks" not used in RagePhysics
RagePhysics.dpr&#40;17,68&#41; Hint&#58; Unit "rpJointUpVector" not used in RagePhysics
RagePhysics.dpr&#40;18,71&#41; Hint&#58; Unit "libNewtonImport" not used in RagePhysics
RagePhysics.dpr&#40;19,48&#41; Hint&#58; Unit "RageExposedTypes" not used in RagePhysics
RagePhysics.dpr&#40;20,38&#41; Hint&#58; Unit "VectorTypes" not used in RagePhysics
RagePhysics.dpr&#40;22,47&#41; Hint&#58; Unit "rpJoints" not used in RagePhysics
Assembling ragephysics
Linking ../../DCU/libRagePhysics.dylib
/usr/bin/libtool&#58; can't locate file for&#58; -lX11
/usr/bin/libtool&#58; file&#58; -lX11 is not an object file &#40;not allowed in a library&#41;
Error&#58; Error while linking

any ideas? if your interested the project is RagePhysicsLibOSX.lpi at http://rage-engine.cvs.sourceforge.net/rage-engine/Rage3D/Exposed/RagePhysicsLib/