First of all, Lazarus is the class libraries for Free Pascal that emulate Delphi. Free Pascal is a GPL’ed compiler that runs on Linux, Win32, OS/2, 68K and more.
I knew it before and frankly speaking always thought that Lazarus is some kind of not a serious thing. However several days ago I found the first issue of Blaise Pascal Magazine in Russian with article of Zeljan about it. “You never know till you try”, I thought, and decided to give Lazarus a chance.
Since I’m a developer of PostgresDAC component suite my first thought was to use it under Lazarus. Well, I spent two days working and suddenly… Now I’m able to create “Hello world!” bagatelle. Anyway “that’s one small step for man, one giant leap for mankind”. 🙂 I think soon we will add official support for Lazarus in PostgresDAC.
Postgresdac under Lazarus
Imagine the following situation. Our product can detect if it is running under WineHQ already. And, indeed, our product has many places from which we must open URL’s:
- information about the product,
- checking for updates,
- online help,
- technical support page
- and so on.
Trying to call ShellExecute head-on, passing the URL as parameter, and … Nothing happens!
The thing is that Wine, honestly emulating everything, wants to start a web browser not installed in the system, but installed under the Wine. There are no any browsers installed yet. Therefore, nothing happens.
Of course, you can install the browser, but why not open the required documents in their native system applications? This raises the question of interaction of the Wine and the operating system.
There are a number of commands available in Wine.
We are interested in winebrowser command, which opens the URL in the native operating system application. And taking into account that URL can refer to the file, we have really serious mechanism in our hands.
On a KDE system the first two might open in Konqueror, the third in Konversation, and the last in KWrite.
As a result, applying the function GetWineAvail (), described earlier, our code might look like this:
procedure OpenUrl(url: string);
if GetWineAvail() then
S := 'winebrowser ' + url
S := url;
ShellExecute(0, 'open', PChar(S), nil, nil, SW_SHOW);
or like this:
void OpenUrl(char * url);
strcpy(s, "winebrowser ");
ShellExecute(NULL, "open", s, NULL, NULL, SW_SHOW);
As was mentioned PgMDD entered beta-testing stage. Details have been promised. Voilà.
Crux of the matter
PgMDD-1.2.8 supports WineHQ out of the box. What mean supports?
- PgMDD always knows if it was launched under Wine or in pure Windows environment
- PgMDD offers several ways to bypass imperfect Wine functionality
- PgMDD disables the functionality which current Wine configuration cannot provide
Lets go on each item.
In the life of every Windows developer there comes a point when you want to know if your application is running under WineHQ or not. Why? Because the world is not perfect. And you for sure will help Wine to crunch your application correctly. Of course if you’re interested in support of millions of guys with red eyes (Mac, Linux etc.). 😉
There is an elegant way to find this out. Below is the Pascal\Delphi code, however any sane developer would be able to translate it into preferred language:
function GetWineAvail: boolean;
var H: cardinal;
Result := False;
H := LoadLibrary('ntdll.dll');
if H > HINSTANCE_ERROR then
Result := Assigned(GetProcAddress(H, 'wine_get_version'));
if GetWineAvail() then
ShowMessage('Launched under Wine')
Сode speaks for itself.
Before we get started:
The day begins as usual, from the Postgres Planet reading. Nothing presaged troubles. 🙂 I was reading the Big Shots post and became curious of the UDD schema.
Official schema documentation plunged me into despair. 🙂 But God bless MicroOLAP (and me of course)! We have the world wide best entity-relationship designer ever.
Thus I made Reverse Engineering and exported model to graphic.
There was some guy, Sherlok, who couldn’t start DB Designer in Wine properly. And I have no idea what he did wrong as my HOWTO is very simple. Yet it’s short… but not anymore! 😉 kishkin rewrote that tutorial with the screenshots, and there are LOTS OF THEM!
Here is photo, kishkin receving free license for Database Designer for PostgreSQL. Lot’s of friends came for the party. 🙂
Despite the fact that my instructions “Database Designer for PostgreSQL under Wine” HOWTO are very clear, there is still one person who just don’t get it. 🙂
This evil man, besides his e-mail scolding, also posted WRONG information to Wine Application Database states that Designer could not be launched.
Here is a screenshot totally disproving his accusations:
PS Damn, spent all night drawing it… 😉