Interoperable Managed and Unmanaged Code in a Document Environment
Managed and unmanaged code may operate in a document environment by enabling managed code to be called by unmanaged code. The managed code may make functions available to unmanaged code by creating a type library and loading the type library into a running object table using a filename identifier. The filename identifier may be used by the unmanaged code to locate the type library and thereby call managed code functions.
1 . A method comprising:
defining an identifier for a first group of managed code;
defining a callable function within said first group of managed code;
defining a type library for said callable function;
adding said identifier to a second group of unmanaged code, said second group of unmanaged code adapted to:
search for said type library using said identifier;
finding said identifier in said running object table;
loading said type library from said running object table; and
calling said callable function.
2 . The method of claim 1 , said identifier comprising a filename.
3 . The method of claim 1 , said identifier comprising a GUID.
4 . The method of claim 1 , said identifier being hardcoded within said second group of unmanaged code.
5 . The method of claim 1 , said managed code and said unmanaged code being callable from a document environment.
6 . A computer readable medium comprising computer executable instructions adapted to perform the method of claim 1 .
7 . A method comprising:
detecting that a document has been opened, said document comprising managed and unmanaged code adapted to be executed within a document environment;
executing said managed code, said managed code comprising an identifier and a type library; and
executing said unmanaged code, said unmanaged code adapted to:
search for said type library using said identifier; and
call at least a portion of said managed code using said type library.
8 . The method of claim 7 , said managed code being adapted to load said type library in a running object table.
9 . The method of claim 7 , said type library being located in a file.
10 . The method of claim 9 , said identifier comprising a directory path for said file.
11 . The method of claim 7 , said identifier comprising a GUID.
12 . The method of claim 7 , said calling comprising identifying an instance of said document from which said at least a portion of said managed code is being called.
13 . The method of claim 7 , said managed code being adapted to detect that said unmanaged code is adapted to call said managed code.
14 . A computer readable medium comprising computer executable instructions adapted to perform the method of claim 7 .
15 . A method comprising:
receiving an identifier for a type library within an unmanaged code environment, said type library comprising a reference to a managed code environment;
searching for said type library using said identifier;
finding said type library in a running object table; and
making a call to said managed code environment from said unmanaged code environment using said type library.
16 . The method of claim 15 , said identifier comprising a file name.
17 . The method of claim 15 , said identifier comprising a GUID.
18 . The method of claim 15 , said managed code environment and said unmanaged code environment being called from within a document environment.
19 . The method of claim 18 , said making a call comprising an instance identifier for said document environment.
20 . A computer readable medium comprising computer executable instructions adapted to perform the method of claim 15 .