Lambda mid function?

03/25/2016 22:11 Terrat#1
Hello, i want to define a lambda function (static) in a naked function(hook) and then call it in asm.
Code:
__declspec(naked) void t()
{
static auto abc=[]....
__asm call abc
}
This wont work, if i change the lambda into an extern void, it works. But why?
03/26/2016 13:15 th0rex#2
Because a lambda expression is not a usual function declaration.
The lambda is an anonymous struct generated by the compiler, that defines the operator ().
Code:
struct some_random_name_generated_by_compiler {
    int myBoundParameter1;
    ... // all parameters that are bound ( in the [] expression) are variables of that struct.
   // the compiler generates the constructor aswell.
   some_random_name_generated_by_compiler(int param1) ...

   return_type operator()(parameters of the lambda here) {
            lambda body here
   }
};
You'd have to call
Code:
lambda::operator()
in your asm.