All pastes #98713 Raw Edit

Miscellany

public text v1 · immutable
#98713 ·published 2006-07-24 19:10 UTC
rendered paste body
				#ifdef IL_CONFIG_PINVOKE
					/* Find the module for the PInvoke record */
					module = ILPInvoke_Module(pinv);
					if(!module)
					{
						return 0;
					}
					name = ILModule_Name(module);
					if(!name || *name == '\0')
					{
						return 0;
					}
					moduleHandle = LocateExternalModule
									(ILExecThreadGetProcess(thread), name, pinv);
					if(moduleHandle)
					{

						/* Get the name of the function within the module */
						name = ILPInvoke_Alias(pinv);
						if(!name || *name == '\0')
						{
							name = ILMethod_Name(method);
						}

						/* Look up the method within the module */
						fnInfo.func = ILDynLibraryGetSymbol(moduleHandle, name);
					}

					/* Flag the method pinvoke. */
					implementationType = _IL_JIT_IMPL_PINVOKE;

					/* now set the on demand compiler function */
					onDemandCompiler = _ILJitCompilePinvoke;

				#else /* !IL_CONFIG_PINVOKE */
					return 0;
				#endif /* IL_CONFIG_PINVOKE */