Jump to content

Recommended Posts

Posted

Is it possible in some way to make parameters optional in an exported C++ win32 dll?

Kind of (this does not work) 

int func(LPCTSTR param1, LPCTSTR param2 = L"param"){
    //stuff
    return 0;
}

Or something similar, I know it's a long shot cause find find anything to suggest there is.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Posted (edited)

Does not work, crashes without error (Well OS error with option to close, wait or check online) when called from AutoIt.

EDIT:

That's fine for internal function but I've not been able to get it to work externally.

Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Posted

Afaik you cannot use optional parameters in DLLs. This is because the C++ compiler handles the optional parameters at compile time. So if you compile a DLL there is no optional parameter possible. But you just can use AutoIt for using optional parameters in your UDF.

Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

Posted

The above is correct. Native functions do not have optional parameters. The headers may indicate default values which the precompiler stage will read and fill in right before compilation.

Example

void method(int parameter = 0)
{
}

int main()
{
    method();
    return 0;
}

// becomes

void method(int)
{
}

int main()
{
    method(0);
    return 0;
}

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
  • Recently Browsing   0 members

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