Sign in to follow this  
Followers 0
darkjohn20

C Return Type

14 posts in this topic

#1 ·  Posted (edited)

The problem was that I was using the wrong command. The correct one returns a string.

The original question didn't make any sense and was too open ended, so it has been removed.

Please don't bump! ;)

Edited by darkjohn20

Share this post


Link to post
Share on other sites



When it doesn't create an array $aReturn gives the value 0. Otherwise it won't give any value.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Yes, it throws an error and returns 0. It's named $aReturn for a reason ;). I also have the $aReturn[0] later in my code, which is why the error is thrown, because [0] doesn't exist.

Edit: I believe that it's not working because of a problem with the return type. My other parameters are correct and I'm accessing it correctly later in the script (as an array, that is).

Edited by darkjohn20

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Show your code that works.

My code doesn't work. I'm trying to figure out why.

All I was stating before was that I have everything set up correctly, it's just the DLL Call that isn't working out.

The two parameters have the correct values, and the function name is right.

I'm accessing it correctly later in the script (as an array, that is).

Meaning that I'm using $aReturn[0] later in my code. The problem is that the DLL call is failing.

My full function is:

Func _GetClientAddressTCP($iInstance, $iClientID)
    Local $aReturn = DllCall($hDLL, "str:cdecl", "GetClientAddressTCP", "ulong_ptr", $iInstance, "ulong_ptr", $iClientID)
    Return $aReturn[0]
EndFunc

And yes, the DLL is defined AND opened.

Edited by darkjohn20

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Hi, what DLL is it?

Try adding error check after the DllCall before even trying to return $aReturn[0]

When it's failing the call is it AutoIt DllCall failing?

eg: @error 1, 2 , 3, 4

Or maybe your meaning that AutoIt DllCall doesn't fail but the call is failing from the dll itself.

Without knowing the proper info about the dll and the data and method of the call then it makes it hard to say where and why your call is failing.

Your posting little info and wanting people to fill in the big picture with guesses and assumptions.

Edit, My guess is that your using a dll from MikeNet aka DarkNet?

Edited by smashly

Share this post


Link to post
Share on other sites

Well, the error code is 3, so I guess the function doesn't exist. I'll review the source code to see if it's under a different name.

I also realize that I'm leaving a big gap. At first I figured that NetAddress was the problem, and I also figured that that was a well known Class or whatever you want to call it.

About 5 minutes after I posted I realized that it wasn't, which would be confusing to anybody reading the topic.

I'll look through the code to see if I can locate the problem. I'll come back when I figure out what is going on.

Thanks for your time and sorry for the confusion.

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

Hi, what DLL is it?

Try adding error check after the DllCall before even trying to return $aReturn[0]

When it's failing the call is it AutoIt DllCall failing?

eg: @error 1, 2 , 3, 4

Or maybe your meaning that AutoIt DllCall doesn't fail but the call is failing from the dll itself.

Without knowing the proper info about the dll and the data and method of the call then it makes it hard to say where and why your call is failing.

Your posting little info and wanting people to fill in the big picture with guesses and assumptions.

Edit, My guess is that your using a dll from MikeNet aka DarkNet?

Yes, I am. Since Mike is a friend of mine I'm asking him about the situation.

This is the function I'm trying to use, and my guess is it isn't in the "Normal DLL", or it's under an extended name.

Edit: AHH. It appears that there is also the command GetClientIPTCP. That's exactly what I need.

Problem is most likely solved, because I seem to remember that command from version 1. ;)

I feel kind of stupid now. That command was there the whole time, but I didn't find it somehow.

Edited by darkjohn20

Share this post


Link to post
Share on other sites

You can't call a constructor with DllCall. It doesn't work that way.

Share this post


Link to post
Share on other sites

You can't call a constructor with DllCall. It doesn't work that way.

Thanks for informing me. I honestly don't have any idea what a constructor is, I was just wondering if it would be of any help. I found the right command so the original question(s) don't need to be answered.

Share this post


Link to post
Share on other sites

What you have is an object. Objects are created using special functions called constructors.

Objects aren't impossible to use in DllCall, but they are very difficult and I'm not entirely sure how you can use them.

Share this post


Link to post
Share on other sites

Alright, thanks. After talking with the creator/writer/whatever you want to call him, I have confirmed that GetClientAddressTCP can only be used in C++, and that GetClientIPTCP is what I was looking for.

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