Watch, Follow, &
Connect with Us

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


Welcome, Guest
Guest Settings
Help

Thread: Porting Delphi Component, where is WinInet?


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


Permlink Replies: 4 - Last Post: Oct 29, 2015 11:37 AM Last Post By: Bojan Nikolic
Bojan Nikolic

Posts: 12
Registered: 10/1/10
Porting Delphi Component, where is WinInet?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 28, 2015 2:04 AM
Hi,

I am currently in process of porting Delphi component into C++ Builder package.

In one file I am using WinInet file functions (WinApi functions) such as InternetOpenUrl and similar. Nothing complex. In Delphi all work fine, but I can't compile same file into Builder.

Example:

[ilink32 Error] Error: Unresolved external 'InternetReadFile' referenced from C:\COMPONENTS\NEXT SUITE 6\PACKAGES\C++ BUILDER XE4\WIN32\DEBUG\NXSTDCTRLS6.OBJ


I have tried to include Winapi and Wiapi.Wininet into unit scopes, tried to include inet.bpi but nothing helps.

Can I somehow access this functions from .pas file?

Please sorry for any stupid questions :)

Thanks.
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: Porting Delphi Component, where is WinInet?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 28, 2015 11:52 AM   in response to: Bojan Nikolic in response to: Bojan Nikolic
Bojan wrote:

[ilink32 Error] Error: Unresolved external 'InternetReadFile'
referenced from C:\COMPONENTS\NEXT SUITE 6\PACKAGES\C++ BUILDER
XE4\WIN32\DEBUG\NXSTDCTRLS6.OBJ

Add wininet.lib to your package. You can find it in the $(BDS)\lib\win32\release
or $(BDS)\lib\win32\release\psdk\ folder.

I have tried to include Winapi and Wiapi.Wininet into unit scopes,
tried to include inet.bpi but nothing helps.

Those have nothing to do with the error.

Can I somehow access this functions from .pas file?

Of course. In fact, Delphi code can statically link directly to the WinInet
DLL using 'external' declarations, so you shouldn't be getting any unresolved
external errors, unless you are trying to call the WinInet functions from
C++ code instead of Delphi code.

--
Remy Lebeau (TeamB)
Bojan Nikolic

Posts: 12
Registered: 10/1/10
Re: Porting Delphi Component, where is WinInet?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 29, 2015 11:07 AM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
Thank you Remy again,

One stupid question, how to add lib to package? I can only add bpi files to requires?

I have found wininet.lib and I can access to the Winapi.Wininet.pas if I use Find Declaration from my uses list.

If nothing, I will definitely call functions by myself. I totally forgot that this is possible since long ago.

Thanks again.
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: Porting Delphi Component, where is WinInet?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 29, 2015 11:33 AM   in response to: Bojan Nikolic in response to: Bojan Nikolic
Bojan wrote:

One stupid question, how to add lib to package?

Use the Project Manager's "Add to Project" option, like any other file.
Or, you can use a "#pragma comment(lib, wininet.lib)" statement in your C++
code.

I can only add bpi files to requires?

Yes. But wininet.lib is not a package, so it does not belong in the Requires
list to begin with.

--
Remy Lebeau (TeamB)
Bojan Nikolic

Posts: 12
Registered: 10/1/10
Re: Porting Delphi Component, where is WinInet?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Oct 29, 2015 11:37 AM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
Thank you Remy, helped.

Remy Lebeau (TeamB) wrote:
Bojan wrote:

One stupid question, how to add lib to package?

Use the Project Manager's "Add to Project" option, like any other file.
Or, you can use a "#pragma comment(lib, wininet.lib)" statement in your C++
code.

I can only add bpi files to requires?

Yes. But wininet.lib is not a package, so it does not belong in the Requires
list to begin with.

--
Remy Lebeau (TeamB)
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02