SETVAR does not support structure passing between parent and child IDL sessions. However, you can work-around this using other methods. I've listed two below. 1) Convert the structure to a string in the main program with IDLDehydrate and JSON_SERIALIZE. Then pass the resulting string to the bridge and then use JSON_PARSE and IDLHydrate to bring it back to the identical structure form. See the example program at the end of this post for how to do this (test_bridgeStructurePass.pro). Note: The Hydrate and Dehydrate functionality was added in IDL 8.5.2. You must use at least that version for this to work. Here is the doc page for this: https://www.harrisgeospatial.com/docs/idlhydrate.html 2) Use the IDL Asynchronous Task Framework instead. Check out IDLAsynBridgeTaskJob which will take care of executing the IDLTask inside a bridge. Parameters for the task need to be defined before it is kicked off. However, the task framework will handle all of the parameter passing between the main IDL session and the bridge (both ways). Many folks don't even know this functionality exists, but it can be super useful in the right circumstances. This was added in IDL 8.7.0: https://www.harrisgeospatial.com/docs/idlasyncbridgetaskjob.html EXAMPLE IDL CODE FOR WORKAROUND #1: pro test_bridgeStructurePass s = {structName, name:'NameOne', data1:50, data2:['a','b','c'], data3:FLTARR(12)} h = hash(s,/extract) j = json_serialize(h.dehydrate()) oBridge = OBJ_NEW('IDL_IDLBridge', OUTPUT='bridge_log.txt') oBridge->Setvar,'j',j oBridge->Execute, 'd = json_parse(j)' oBridge->Execute, "h = IDLHydrate(d,TYPE='ORDEREDHASH')" oBridge->Execute, 's = h.ToStruct()' oBridge->Execute, 'help,s & print,s' OBJ_DESTROY, oBridge end
|