Hi Jang,
perhaps ExternalObject could be a solution for that. ExternalObject allows ExtendScripts to call functions in C dlls.
So an ExternalObject works as a connector to a world outside of ExtendScripts, with interfaces in both ways.
There is an example for ExternalObjects in Adobe\Adobe Utilities\ExtendScript Toolkit CS4\SDK\Samples\cpp.
Don't know if this works or could be a solution for this and I don’t know if my thoughts are in the right direction.
I hope this information is useful nevertheless.
If there is a way, which is easier or if somebody has got experiences with ExternalObjects please let me know.