Sign in to follow this  
Followers 0
sainthout

don't know how to call c++ function

5 posts in this topic

#1 ·  Posted (edited)

Hi,

I want to use the WiiYourself library in autoit, but I don't know how to call it's functions:

bool wiimote::Connect (unsigned wiimote_index, bool force_hidwrites)
    {
    if(wiimote_index == FIRST_AVAILABLE)
        TRACE(_T("Connecting first available Wiimote:"));
    else
        TRACE(_T("Connecting Wiimote %u:"), wiimote_index);

Posted Image

Can somebody help me a bit with this?

Thnx

Edited by sainthout

Share this post


Link to post
Share on other sites



The first code snippet you showed was a C++ class method, thus this is not a simple task. What you're seeing in the export viewer is the flat api version of the library.

If you're lucky this works.

$call=DllCall("wiimote.dll","int","ZN7wiimote7ConnectEjb","uint",0,"char",1)

Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Thnx for your reply.

I tried it, but it sets @error to 1.

When I try this it doesn't set @error, but it returns 0 (so it also didn't work)

DllCall("wiimote.dll", "int", "_ZN7wiimote7ConnectEjb")
Edited by sainthout

Share this post


Link to post
Share on other sites

Thnx for your reply.

I tried it, but it sets @error to 1.

When I try this it doesn't set @error, but it returns 0 (so it also didn't work)

DllCall("wiimote.dll", "int", "_ZN7wiimote7ConnectEjb")
You looked for that return value in an array... right? (You didn't post the code you tried.)

:D


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

You can’t call c function directly from Lua, you have to create a wrapper function that allows calling from Lua. In this post, shows a simple example to implement millisecond sleep function to Lua using nanosleep.

Edited by Valik

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0