Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Console App and QApplication?

Status
Not open for further replies.

ahhchu

Programmer
Sep 19, 2001
38
US
I created a simple CONSOLE applicationt that calls a shared memory DLL to retireve some data. The application is all of 15 total lines. When I run the application I get the following message:

QApplication::palette: This function can only be called after the QApplication object has been created

The program then displays the data I expect

When I take my call to the DLL out the message stops.. Any clues why it appears and why a QApplication object is involved? I would like to suppress the message or resolve why it appears?

Thanks
 
It sounds like this is not a Delphi problem, but something in your DLL. Could your DLL have something inside it called QApplication? View the DLL with your favourite hex editor and take a look.

Try using the same DLL function in a Delphi GUI app and see what you get. -- Doug Burbidge mailto:doug@ultrazone.com
 
Doug,
When I run it in a regular Delphi GUI app I dont see the message. The QApplication object is part of the QT stuff for creating open apps. I dont understand where it comes from in either the console app or the DLL as they are both delphi projects.

In any case is there a way to suppress the messages?

Thanks
 
What Units are listed in the USES clause of your console app?
 
mgauss
SysUtils and dlldata, a unit I created are all thats specified. The dlldata unit is:

unit dllData;

interface

type
PDllCommonData = ^TDllCommonData;
TDllCommonData = record
sToken : string [64]; // make it long enough that typing it is a pain
end;

implementation

end.

Thanks
 
This comes from D5's helpfile:
>>>>Clip:
If a DLL exports routines that pass long strings or dynamic arrays as parameters or function results (whether directly or nested in records or objects), then the DLL and its client applications (or DLLs) must all use the ShareMem unit. The same is true if one application or DLL allocates memory with New or GetMem which is deallocated by a call to Dispose or FreeMem in another module. ShareMem should always be the first unit listed in any program or library uses clause where it occurs.

ShareMem is the interface unit for the BORLANDMM.DLL memory manager, which allows modules to share dynamically allocated memory. BORLANDMM.DLL must be deployed with applications and DLLs that use ShareMem. When an application or DLL uses ShareMem, its memory manager is replaced by the memory manager in BORLANDMM.DLL.
>>>>End clip

Hopes this gives some breathingspace ;-)
Grtz, TonHu
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top