Copy link to clipboard
Copied
Hi
In Extendscript I create an ExternalObject object. It is an DLL in Visual C++. I call a function in it and obtain the result then I unload it.
var basiceo = new ExternalObject("lib:" + "d:/file.dll");
alert(basiceo.getAverage(10, 20, 0));
basiceo.unload();
This is just like the sample in Extendscript Toolkit SDK.
Now if I make change in the DLL code, I can not build(compile) it any more. It gives me this error:
error LNK1104: cannot open file 'd:/file.dll'
It seems that the file has not been closed. If I close the Extendscript, I can build(compile) the code without error.
How can I finish the external object in extendscript correctly?
Thanks
Copy link to clipboard
Copied
Copy link to clipboard
Copied
In what way? Could you tell me an example?
close("d:/file.dll"
);
Error: close is not a function
File.close("d:/file.dll"
);
Error: File.close is not a function
basiceo.close();
Error: basiceo
.close is not a function
Copy link to clipboard
Copied
I'm on Mac OSX, so I'm not sure about the file path syntax here.
Also, if at all it is possible to open a dll kind of file by ExtendScript.
But you could try the following:
//I'm not sure about the file path here,
//because I'm on Mac OSX.
//Basically it should work this way:
var myFile = new File("d:/file.dll");
if(myFile.exists){
myFile.open("r"); //Read only
myFile.close();
};
Uwe
Copy link to clipboard
Copied
Thank you for your response but My "basiceo" is an externalobject object not a File! So it does not have close method.
I can not even imagine this code works. I think they are completely two different things.
var basiceo = new ExternalObject("lib:" + "d:/file.dll");
and
var myFile = new File("d:/file.dll");
Copy link to clipboard
Copied
From the Scripting Guide, page 200,
mylib = new ExternalObject ("lib:" + samplelib); // load the library
alert(mylib.version) ;
// access functions directly from ExternalObject instance
var a = mylib.method_abc(1,2.0,true, "this is data") ;
alert(a) ;
mylib.unload() ;
So externalObjects have an "unload" method.
Worth trying.
They might have other useful methods, you can put a breakpoint at the creation point of basiceo at scout the ESTK data browser.
Xavier
Copy link to clipboard
Copied
Hum, i wrote that too fast: still from the Scripting Guide, instances of ExternalObject have just one method: terminate();
So the 'unload' method in the above post was probably assumed to be one defined int he library itself.
Xavier.
terminate()
ExternalObject_obj.terminate ()
Explicitly shuts down the ExternalObject dynamic library wrapped by this instance.
It can be helpful to force a shutdown of the external library if termination of external libraries during
the shutdown of the hosting application does not occur in the correct order.
Returns undefined.
Copy link to clipboard
Copied
UQg‌
the "ExternalObject_obj.terminate ()" returns "undefined". It means that there is something wrong. I had tried it before.
I also tried these things however they did not work.
ExternalObject.unwatch();
ExternalObject.ESTerminate();
Copy link to clipboard
Copied
the "ExternalObject_obj.terminate ()" returns "undefined". It means that there is something wrong.
basiceo.terminate() : Explicitly shuts down the ExternalObject dynamic library wrapped by this instance (basiceo).... Returns undefined.
So, that it returns undefined is completely normal, not wrong. But why it does not shut down the library i can't tell...
Xavier.
Copy link to clipboard
Copied
Try this:
basiceo= null;
delete basiceo;
$.gc ();
Copy link to clipboard
Copied
The null might do something but the delete won't.
Vars are flagged that they cannot be deleted only globals or object / array elements can be deleted.
It's easier to make a mess than to clean it up!
In terms of compiling I would think that a log out should fix it?