bitshadow Posted March 10, 2008 Share Posted March 10, 2008 i have a C function i want to call from autoit with the dllcall function. one of the functions take a FILE * and i notice when i try to call my code crashes in Autoit? i'm assuming FILE * is not supported in autoit because i tried just putting a void pointer and it still seems to crash. Does DllCall support the FILE * and if not is there any way to work around it or no? thanks in advance. Link to comment Share on other sites More sharing options...
evilertoaster Posted March 10, 2008 Share Posted March 10, 2008 It doesn't support the native type 'FILE' (from the standard library I'm asuming). But you could be able to work around that by either using a dllstruct to create the type from native types or using a native type and seeing if it works with parameter anyway. Might try seraching around abit also, seems like someone might have wanted to do this by now and could have asked the question already... Link to comment Share on other sites More sharing options...
bitshadow Posted March 10, 2008 Author Share Posted March 10, 2008 It doesn't support the native type 'FILE' (from the standard library I'm asuming). But you could be able to work around that by either using a dllstruct to create the type from native types or using a native type and seeing if it works with parameter anyway.Might try seraching around abit also, seems like someone might have wanted to do this by now and could have asked the question already...thank you. i'll check and see about creating the struct however i did search on the forums couldn't find anything. maybe i try google now. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 10, 2008 Moderators Share Posted March 10, 2008 i have a C function i want to call from autoit with the dllcall function. one of the functions take a FILE * and i notice when i try to call my code crashes in Autoit? i'm assuming FILE * is not supported in autoit because i tried just putting a void pointer and it still seems to crash. Does DllCall support the FILE * and if not is there any way to work around it or no?thanks in advance.did you try "str" or "str*"? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
bitshadow Posted March 10, 2008 Author Share Posted March 10, 2008 did you try "str" or "str*"?yup just did. still seg faults. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 10, 2008 Moderators Share Posted March 10, 2008 yup just did. still seg faults.Do you have documentation on the dll and the dll itself? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
bitshadow Posted March 10, 2008 Author Share Posted March 10, 2008 (edited) Do you have documentation on the dll and the dll itself?thanks for your help smoke in advance. i've attached the devC++ project along with some basic documentationEDIT: removed attachement Edited March 11, 2008 by bitshadow Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 11, 2008 Moderators Share Posted March 11, 2008 thanks for your help smoke in advance. i've attached the devC++ project along with some basic documentationDid you test this before you wrapped it up as a dll?Anything wrong with the native FileListToArray and or the UDFs _FileListToArrayEx (and the ones in randallac's signature)? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
bitshadow Posted March 11, 2008 Author Share Posted March 11, 2008 (edited) Did you test this before you wrapped it up as a dll?i actually have been using it for a while as a command line utility. i just wanted to add a gui on it and stumbled across autoitv3 and decided to try it out. unforutunetly w/o much success. i have also compiled, linked and used the code both from a lib and .dll file as well.i noticed there was a "plugin" feature jon added but i haven't check that out yet and it is becoming more of a chore trying to wrap a gui around this w/autoitv3Anything wrong with the native FileListToArray and or the UDFs _FileListToArrayEx (and the ones in randallac's signature)? i haven't checked out the filelisttoarray function yet, but i did rewrite the program using the FileReadToArray function however the performence was dismal, and - maybe its my novice knowledge of autoit - but it actually seemed like more work to get it to do what i wanted. i'll check out the above functions you said if not, i might just have to settle for using the win32 api or gtk+ for the interface.edit: just to clarify are you saying calling a File* with a str* or str argument to dllcall should have/ or has worked before? Edited March 11, 2008 by bitshadow Link to comment Share on other sites More sharing options...
bitshadow Posted March 11, 2008 Author Share Posted March 11, 2008 But you could be able to work around that by either using a dllstruct to create the type from native types or using a native type and seeing if it works with parameter anyway.from devc++ stdio for FILE type /* * The structure underlying the FILE type. * * Some believe that nobody in their right mind should make use of the * internals of this structure. Provided by Pedro A. Aranda Gutiirrez * <paag@tid.es>. */lol. but i will give it try evilertoaster Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 11, 2008 Moderators Share Posted March 11, 2008 i actually have been using it for a while as a command line utility. i just wanted to add a gui on it and stumbled across autoitv3 and decided to try it out. unforutunetly w/o much success. i have also compiled, linked and used the code both from a lib and .dll file as well. i noticed there was a "plugin" feature jon added but i haven't check that out yet and it is becoming more of a chore trying to wrap a gui around this w/autoitv3 i haven't checked out the filelisttoarray function yet, but i did rewrite the program using the FileReadToArray function however the performence was dismal, and - maybe its my novice knowledge of autoit - but it actually seemed like more work to get it to do what i wanted. i'll check out the above functions you said if not, i might just have to settle for using the win32 api or gtk+ for the interface. edit: just to clarify are you saying calling a File* with a str* or str argument to dllcall should have/ or has worked before?No, you have to create the struct if it requires one with DllStructCreate(), then use the pointer function, DllStructSetData()/DllStructGetPtr(). So something like: $tStruct = DllStrucCreate("char[256]") DllStructSetData($tStruct, 1, "FileName") DllCall("mydll.dll", "void", "Function", "ptr*", DllStructGetPtr($tStruct, 1)) Also, do you have to turn the string to a wide char string? I didn't look at the code too much to be honest. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
bitshadow Posted March 11, 2008 Author Share Posted March 11, 2008 No, you have to create the struct if it requires one with DllStructCreate(), then use the pointer function, DllStructSetData()/DllStructGetPtr(). So something like: $tStruct = DllStrucCreate("char[256]") DllStructSetData($tStruct, 1, "FileName") DllCall("mydll.dll", "void", "Function", "ptr*", DllStructGetPtr($tStruct, 1)) Also, do you have to turn the string to a wide char string? I didn't look at the code too much to be honest.so i found a workaround to my problem of wanting to use autoit as a win32 gui for my C program. i simply used the run and stdin and stdout functions so this way i get the best of both worlds. fast performence in C code and i can put the Autoit GUI over it. I don't have to compile any DLL or call any code from it. The funny thing is all this time i was trying to use Dllcall, plugin, or even _filetoarray and i neglected exactly what Autoit was made for in the first place automation. good to know; and this way i get to play around with Autoitv3 which is what i wanted in the first place its nice/convenient abstraction/wrapper somewhat over the win32api/MFC code. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now