Author | Topic: issues with EXTERN | |
---|---|---|
Itai Ben-Artzi | issues with EXTERN on Sat, 14 Mar 2020 16:42:33 -0700 Using Extern change the charecteristic of the PRG. For example, using EXTERN in a procedure turns it into a function and using EXTERN in a function creates compiler error. Also, what are the differences between CDECL (C calling convention) and STDCALL (Standard for the Windows 32bit API)? I have a DLL compiled by Studio with a function disableMagstripeDevice(). Dependency Walker shows this function as _disableMagstripeDevice@0(). How this function should be called? Many thanks, -Itai | |
Andreas Gehrs-Pahl | Re: issues with EXTERN on Sat, 14 Mar 2020 22:33:10 -0400 Itai, >Using Extern change the charecteristic of the PRG. For example, using >EXTERN in a procedure turns it into a function and using EXTERN in a >function creates compiler error. You can't use EXTERN inside a Procedure, Function, or Method. Just like the DLLFUNCTION command (which it basically replaces), the pre-compiler will convert the EXTERN command into a separate (DLL) Function. >Also, what are the differences between CDECL (C calling convention) >and STDCALL (Standard for the Windows 32bit API)? Short version: With CDECL, the caller cleans up the stack, while with STDCALL, the function you call cleans up the stack before returning. Long version: https://en.wikipedia.org/wiki/X86_calling_conventions >I have a DLL compiled by Studio with a function >disableMagstripeDevice(). Dependency Walker shows this function as >_disableMagstripeDevice@0(). How this function should be called? Try either way, and see which one works, but I guess the name was changed by "name mangling", and you probably need to use the second version. See also: https://en.wikipedia.org/wiki/Name_mangling Hope that helps, Andreas Andreas Gehrs-Pahl Absolute Software, LLC phone: (989) 723-9927 email: Andreas@AbsoluteSoftwareLLC.com web: http://www.AbsoluteSoftwareLLC.com [F]: https://www.facebook.com/AbsoluteSoftwareLLC | |
Itai Ben-Artzi | Re: issues with EXTERN on Sat, 14 Mar 2020 23:18:12 -0700 Thank you, Andreas. I cannot use the second option because xBase++ cannot handle a function that include the @ character. Using the first option errs: Function is not declared. I should find another scanner with a well written API or ActiveX. Again, thank you for the quick response. Yes, it helps! -Itai | |
Andreas Gehrs-Pahl | Re: issues with EXTERN on Sun, 15 Mar 2020 13:51:55 -0400 Itai, >I cannot use the second option because xBase++ cannot handle a >function that include the @ character. That's not true. DLLCall() and DLLPrepareCall() can handle those kinds of functions just fine. You might have to use those functions directly, instead of using the pre-processor to convert EXTERN or DLLFUNCTION to create a separate function. One way to easily accomplish this, is to use the command version with the non-mangled function name and use the /p compiler option to retain the *.ppo file. Then you can copy the created code from the *.ppo file into your *.prg file, replacing the function name with the mangled one. Hope that helps, PS: It's Xbase++ (not xBase++) Andreas Andreas Gehrs-Pahl Absolute Software, LLC phone: (989) 723-9927 email: Andreas@AbsoluteSoftwareLLC.com web: http://www.AbsoluteSoftwareLLC.com [F]: https://www.facebook.com/AbsoluteSoftwareLLC | |
Itai Ben-Artzi | Re: issues with EXTERN on Sun, 15 Mar 2020 16:47:48 -0700 Thank you, Andreas! WORKING GREAT!!!! -Itai |