Importing Interfaces

Hello guys:

I´m trying to use an Interface in Pascal Script and I´m having some issues.

procedure SIRegister_IXMLNode(CL: TPSPascalCompiler);
begin
//with RegInterfaceS(CL,‘IUNKNOWN’, ‘IXMLNode’) do
with CL.AddInterface(CL.FindInterface(‘IUNKNOWN’),IXMLNode, ‘IXMLNode’) do
begin
RegisterMethod(‘Function GetAttribute( const AttrName : DOMString) : OleVariant’, cdRegister);
RegisterMethod(‘Function GetAttributeNodes : IXMLNodeList’, cdRegister);
etc…
RegisterMethod(‘Procedure SetAttribute( const AttrName : DOMString; const Value : OleVariant)’, cdRegister);
etc…

On my script (as below) I try to use a method that has parameters, but it fails on compiling it, while it works OK for methods with no

Parameters.

var
LDocument: TXMLDocument;
LNodeElement, NodeCData, NodeText: IXMLNode;
DestPath, SrcPath: DOMString;
LNode: IXMLNode;
begin
DestPath := ‘c:\temp\dest.xml’;
SrcPath := DestPath;
LDocument := TXMLDocument.Create(DestPath);

LDocument.DocumentElement := LDocument.CreateNode('ThisIsTheDocumentElement', ntElement, '');
LNode := LDocument.DocumentElement;
LNode.Normalize;
LNode.SetAttribute('attrName', 'attrValue'); <<<<< FAILS HERE
etc...

Compiler message: Compiler: [Error] Main(15:9): Unknown identifier ‘SETATTRIBUTE’

Is there any limitation on Pascal Script on supporting these kind of methods?

Thanks for your help. If you need any extra details, please let me know.


Jackson

I´ve found why my call to SetAttribute is failing: because OleVariant is not declared to the Script Engine and so the SetAttribute method is not registered too (but no errors are emitted)

Any idea on how to declare/define it?

CL.AddType(‘OleVariant’, btVariant);

Although I can compile some test scripts, the problem now is to make it run properly.

I have a application variable called XMLDoc: TMXLDocument that I can access on my scripts. For example

LogInfo(XMLDoc.XML.Text); works OK when I run the scripts, but

procedure OnMapEvent(var Value:Variant); //LINE1
var
lNode: IXMLNode;
begin
lNode := XMLDoc.DocumentElement; (AV occurs HERE)
LogInfo('lNode.NodeName: ’ + lNode.GetNodeName);
end;

does not work fine, ie, trying to access any Interface reference is problematic. DocumentElement should result a IXMLNode, but I get an AV (Exception: Access violation at address 0040820C in module ‘Flow.exe’. Read of address 00000000) when executing the red line and basically nothing else works.

My question is:

Does Pascal Script support correctly Interface objects or Am I doing something wrong?

Thanks

Hello,
Logged as #49 for investigation

Hi… thanks for looking at this issue.

Do you have a time frame/schedule for this? We need to know about it because my company needs to make a decision as we have customers waiting for a specific feature to be implemented.

Thanks again


Jackson Gomes

not sure if it helps, but the error is raised on file x86.inc

function RealCall_Register

mov eax,_EAX
mov edx,_EDX
mov ecx,_ECX
call p (AV occurs HERE)

Hello,
Unfortunately, PascalScript is obsolete and has low priority.

can you at least please confirm if this is a bug or not? Thank you

Hello, Looks like it’s a bug