Jump to content

don't know how to call c++ function


Recommended Posts

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
Link to comment
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!

Link to comment
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")
Edited by sainthout
Link to comment
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
Link to comment
Share on other sites

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...