-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using gputtylib.pas and gputtysftp.pas in RADStudio C++ project #28
Comments
Hello, Please see the C++ examples. |
Hi Tobias, I gave up trying to use the PAS files in a C++ Builder project. You can mix CPP and PAS (I do it occasionally) in a C++Builder project, but you can't use the PAS code to call a DLL. It doesn't matter if you include the LIB file and HPP. The PAS code to use functions in the DLL can't be used in a C++Builder project. I decided to focus my time on working out why the C++ file tgputtylibcbclass.cpp was crashing with no call stack to play with. The main problem was that I didn't have SUPPORTDELPHISTREAMS defined. This is defined in tgputtycbsftpclient.h, but I wasn't including this file as I don't want to use the component. Once I defined SUPPORTDELPHISTREAMS nearly all my problems disappeared. C++ Builder (10.3.2) doesn't seem to like the thrown exceptions, e.g. throw TTGPuttySFTPException(MakePSFTPErrorMsg("tgsftp_getfile")); I've no idea why this crashes, but it's no problem, as I can just just delete the exception and return an error code. I never got the CPPBuilderClassDemo.cbproj project to link. There's a lot of unresolved externals related to AnsiString. I expect adding a VCL form to the project would sort it out, but I didn't try. Now I've spent some time going through the code, I can appreciate how much work you've put into this and what an amazing job you've done. I've thoroughly enjoyed learning about SFTP, Delphi DLL etc. Sorry I didn't spot my obvious mistake of not including SUPPORTDELPHISTREAMS earlier, but I secretly blame C++ Builder as it wasn't letting me step through the code properly. It allowed me to enter the DownloadStream function even without SUPPORTDELPHISTREAMS defined. Builder is weird. Thanks again for all your hard work and generosity. Amusingly, the project I was going to need SFTP for has now disappeared, but no regrets. I'm sure it will be useful in future. Cheers, |
Hi, thanks for the great software. I'm trying to add gputtylib.pas and gputtysftp.pas to a C++ Builder project. I can usually mix PAS and CPP with no problem, but I am getting an unresolved external for each procedure in gputtylib.pas that declared to be in the DLL. here's an example.
procedure tggetstructsizes(const Pulongsize,Pnamesize,Pattrsize,Pnamessize:PInteger); cdecl; external tgputtydll {$ifdef HASDELAYED}delayed{$endif};
I can use the PAS files in a Delphi program with no problem. Any ideas what I can do to keep the linker in C++Builder happy.
As an aside, I have made a C++ project using the C++ specific files, but it crashes when downloading a file from an SFTP server. This is why I'd like to use the PAS files, as they work perfectly in a Delphi app.
The text was updated successfully, but these errors were encountered: