Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Access violation instancing TIdHTTP


This question is answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 5 - Last Post: Sep 20, 2016 3:06 AM Last Post By: Davide Quagliotto
Davide Quagliotto

Posts: 13
Registered: 10/5/08
Access violation instancing TIdHTTP  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 8, 2016 6:04 AM
Hello,
I have a little project "VCL Forms Application" (C++ Builder XE) with a .cpp file with various functions. In one of these functions there is a row that create a new instance of TIdHTTP: "TIdHTTP* pIdHTTP = new TIdHTTP(NULL);" and I'm able to use it without problems.

If I copy this .cpp file and I use it in a big project (a file .exe that use more than thirty .bpl and dozens of .dll and with more than four millions of lines of c++) always of kind "VCL Forms Application", I have an access violation on row "TIdHTTP* pIdHTTP = new TIdHTTP(NULL);".
If I use debug in that row, and press F7 I entry in various constructors:

/* TIdBaseComponent.Create / inline __fastcall TIdTCPClientCustom(Classes::TComponent AOwner)/* overload */ : Idtcpconnection::TIdTCPConnection(AOwner) { }
/* TIdBaseComponent.Create / inline __fastcall TIdTCPConnection(Classes::TComponent AOwner)/* overload */ : Idcomponent::TIdComponent(AOwner) { }
/* TIdBaseComponent.Create / inline __fastcall TIdComponent(Classes::TComponent AOwner)/* overload */ : Idbasecomponent::TIdBaseComponent(AOwner) { }

all in file "IdTCPConnection.hpp".

They work all correctly but when I press F7 in last one I have the Access Violation.

What can it be?

Thanks.
Davide.
Arkady Semylio

Posts: 87
Registered: 9/18/15
Re: Access violation instancing TIdHTTP  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 8, 2016 11:27 AM   in response to: Davide Quagliotto in response to: Davide Quagliotto
Davide Quagliotto wrote:
Hello,
I have a little project "VCL Forms Application" (C++ Builder XE) with a .cpp file with various functions. In one of these functions there is a row that create a new instance of TIdHTTP: "TIdHTTP* pIdHTTP = new TIdHTTP(NULL);" and I'm able to use it without problems.

If I copy this .cpp file and I use it in a big project (a file .exe that use more than thirty .bpl and dozens of .dll and with more than four millions of lines of c++) always of kind "VCL Forms Application", I have an access violation on row "TIdHTTP* pIdHTTP = new TIdHTTP(NULL);".
If I use debug in that row, and press F7 I entry in various constructors:

What can it be?

Try to pass 0 instead of NULL. Or try to check if macro NULL isn't been defined elsewhere with a bad value.

Bye bye
Davide Quagliotto

Posts: 13
Registered: 10/5/08
Re: Access violation instancing TIdHTTP  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 9, 2016 12:04 AM   in response to: Arkady Semylio in response to: Arkady Semylio

Try to pass 0 instead of NULL. Or try to check if macro NULL isn't been defined elsewhere with a bad value.

Bye bye

Hello, thanks for the answer.
I tried to set the value to 0 but the result does not change, I have always an Access Violation.
I also tried to put "Application->MainForm" instead of '0' but nothing.

I tried to do another test:
The function containing the incriminated call is on bpl and when I call it from the main exe, I have the Access Violation.
If I move the file containing this function on exe project, the call work correctly.

What could be missing in bpl project that determines the failure of using this function from external exe?

Thanks.
Davide Quagliotto

Posts: 13
Registered: 10/5/08
Re: Access violation instancing TIdHTTP  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 18, 2016 11:44 PM   in response to: Davide Quagliotto in response to: Davide Quagliotto
Hello,
Nobody knows what can I do?

Thanks.
Sean Hoffman

Posts: 126
Registered: 3/28/99
Re: Access violation instancing TIdHTTP  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 19, 2016 9:21 AM   in response to: Davide Quagliotto in response to: Davide Quagliotto
Davide Quagliotto wrote:
Hello,
Nobody knows what can I do?

Thanks.

What is the target platform for your Application and other build artifacts?
I'm assuming you're using dynamic linking in all your targets?
Are you building with or without runtime packages?
Davide Quagliotto

Posts: 13
Registered: 10/5/08
Re: Access violation instancing TIdHTTP  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 20, 2016 3:06 AM   in response to: Sean Hoffman in response to: Sean Hoffman
What is the target platform for your Application and other build artefacts?
I'm assuming you're using dynamic linking in all your targets?
Are you building with or without runtime packages?

Hello,
the target platform is "32 bit Windows".
Yes, I have all projects with "Dynamic linking" activated and runtime packages activated too.

Anyway, after your request, I have realized that in my big project now work correctly!
I have investigate to understand why now it works and I have found the solution to my problem!

I add here the solution if somebody needs to solve similar issue.
In 'Project Manager", in my main exe project files list there were "IndyCore.lib", "IndyProtocols.lib" e "IndySystem.lib".
But inside the tag "<AllPackageLibs></AllPackageLibs>" of file ".cbproj" of main exe project this files were missing.
Therefore when I added in "<AllPackageLibs></AllPackageLibs>" tag the string "IndyProtocols.lib;IndyCore.lib;IndySystem.lib", everything started to work correctly.

Thanks for your interest. :-)

Davide.

Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02