logo
down
shadow

How to create a void function in Assembly?


How to create a void function in Assembly?

By : Nandakishore
Date : November 19 2020, 12:41 AM
I think the issue was by ths following , You should not place any value. Even if you do the caller won't know about it anyway.
code :


Share : facebook icon twitter icon
cannot convert '*void(MyClass::*)(void*) to void*(*)(void*) in pthread_create function

cannot convert '*void(MyClass::*)(void*) to void*(*)(void*) in pthread_create function


By : Ahò Jàck Comàndêr
Date : March 29 2020, 07:55 AM
Any of those help i'm trying to create a new thread with a class "CameraManager" but i have the following error: ,
I don't want to declare dequeueLoop as a static function
code :
static void * dequeueEntry(void * self) {
    return static_cast<CameraManager*>(self)->dequeueLoop();
}

dequeueThreadId = pthread_create(
    &dequeueThread, NULL, 
    &CameraManager::dequeueEntry, // <-- pointer to trampoline function
    this);                        // <-- pointer to object for member function
std::thread thread(&CameraManager::dequeLoop, this);
Executing void(char*) function as a void(void)

Executing void(char*) function as a void(void)


By : sib
Date : March 29 2020, 07:55 AM
Any of those help
But executing void(int) function as a void(void) function with its function and parameters in memory is new to me.
Passing the function *cmp(const *void, const *void) as a parameter in C and using it to create a queue?

Passing the function *cmp(const *void, const *void) as a parameter in C and using it to create a queue?


By : Dezaum
Date : March 29 2020, 07:55 AM
With these it helps cmp is parameter of createQueue, it is a function pointer passed in by the caller. Typically cmp it will return:
a negative integer if *a is less than *b 0 if *a is equal to *b a positive integer if *a is greater than *b
code :
int a = 1, b = 2, c = 2;
cmp(&a, &b); // returns < 0
cmp(&b, &c); // returns 0
cmp(&b, &a); // returns > 0
int cmp(const void * a, const void * b) {
    const int * a_int_ptr = (const int *)a;
    const int * b_int_ptr = (const int *)b;

    int a_value = *a_int_ptr;
    int b_value = *b_int_ptr;

    return a_value - b_value;
}
Calling a void function(int) with a void(*)(void) pointer and prepare stack yourself with arguments

Calling a void function(int) with a void(*)(void) pointer and prepare stack yourself with arguments


By : user4876931
Date : March 29 2020, 07:55 AM
This might help you What you are trying to do is undefined behaviour. In standard C it is not possible to construct a function call with arbitrary argument types at runtime. You cannot make assumptions about the layout in which variables end up on the stack (if at all) either. You cannot even assume that function arguments are passed on the stack.
If you want to do something like this, consider looking into libraries like the libffi which does something like that by implementing a different solution for each platform and each operating system.
CREATE ASSEMBLY for assembly 'dotnetpiper.CLR' failed because assembly 'microsoft.visualbasic.activities.compiler'

CREATE ASSEMBLY for assembly 'dotnetpiper.CLR' failed because assembly 'microsoft.visualbasic.activities.compiler'


By : tw2323
Date : March 29 2020, 07:55 AM
seems to work fine Mixed-mode Assemblies are not allowed in SQLCLR Assemblies; only pure MSIL Assemblies are allowed.
I have this particular issue more fully documented in the following Stack Overflow answer:
shadow
Privacy Policy - Terms - Contact Us © ourworld-yourmove.org