Bug 4718 - AOT request: wrapper methods for invocations to Marshal.GetDelegateForFunctionPointer
Summary: AOT request: wrapper methods for invocations to Marshal.GetDelegateForFunctio...
Alias: None
Product: iOS
Classification: Xamarin
Component: XI runtime ()
Version: 5.3.x
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Blocks: 4781
  Show dependency tree
Reported: 2012-04-29 12:13 UTC by Miguel de Icaza [MSFT]
Modified: 2012-05-18 08:41 UTC (History)
3 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Comment 1 Zoltan Varga 2012-04-30 05:22:43 UTC
The problem here is that the wrapper is associated with the native function address, as its name shows, so it would be hard to pre-generate it.
Comment 2 Miguel de Icaza [MSFT] 2012-04-30 10:52:34 UTC
Do we have any alternatives to support something like this?
Comment 3 Zoltan Varga 2012-04-30 11:07:00 UTC
Not currently.
Comment 4 Rolf Bjarne Kvinge [MSFT] 2012-05-17 05:26:04 UTC
Maybe we could a native function that takes the function pointer as an argument instead of baking it into the method itself? It would require special delegates though that captures the function pointer in the delegate instance.
Comment 5 Zoltan Varga 2012-05-17 06:29:00 UTC
That could work.
Comment 6 Zoltan Varga 2012-05-17 21:32:07 UTC
It looks like this is much easier to fix, and can be done without trampolines.
Comment 7 Zoltan Varga 2012-05-18 08:41:42 UTC
Fixed in master/mobile-master. The delegate which wraps the native functions need to be decorated
with a new attribute:

[AttributeUsage (AttributeTargets.Delegate)]
class MonoNativeFunctionWrapperAttribute : Attribute {

public delegate int SimpleDelegate (int a);