Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > C/C++
You last visited: Today at 06:50

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Lambda mid function?

Discussion on Lambda mid function? within the C/C++ forum part of the Coders Den category.

Reply
 
Old   #1
 
Terrat's Avatar
 
elite*gold: 130
Join Date: Apr 2012
Posts: 1,173
Received Thanks: 670
Lambda mid function?

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?
Terrat is offline  
Old 03/26/2016, 13:15   #2
 
elite*gold: 46
Join Date: Oct 2010
Posts: 782
Received Thanks: 525
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.
th0rex is offline  
Reply


Similar Threads Similar Threads
Running Function 2 after Function 1 finished
09/15/2013 - AutoIt - 3 Replies
Hey, its me again. Im stuck on a problem since yesterday and as much as i hate to ask for help, i really dont know what else to try. I want Function 2 to run after Function 1 has finished. I tried GuiCtrlSetOnEvent and MsgLoop, but i dont really understand it. I tried to read tutorials but they didnt help at all. The line that are underline is what im talking about. I want gamestart() to run first and when its finished, i want iniviteteam() to run. #AutoIt3Wrapper_UseX64=n...
lambda bug
06/28/2012 - DarkOrbit - 5 Replies
LAMBDA GALAXY GATE BUG - WARNUNG!!! - YouTube can someone translate it?
Lambda gate
06/28/2012 - DarkOrbit - 17 Replies
Lambda gate added On Eg2. 45 parts needed.
Lambda by Me :)
06/28/2012 - DarkOrbit - 13 Replies
i m done Lambda Biuld :) Round 1: 1 . wawe - 8 Boss Streuner 2. wawe - 8 Boss Lordakia 3. wawe - 8 boxx Lordakia Round 2: 4. wawe - 6x Boss Mordor 5. wawe - 6x Boss Saimon 6. wawe- 6x Boss Saimon Round 3:



All times are GMT +2. The time now is 06:50.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.