[Gambas-user] About library and component packaging in Gambas 3

Benoît Minisini gambas at ...1...
Sat May 5 03:59:48 CEST 2012


Le 05/05/2012 03:42, Bruce Bruen a écrit :
> On Sat, 2012-05-05 at 02:45 +0200, Benoît Minisini wrote:
>> Le 04/05/2012 23:34, Benoît Minisini a écrit :
>>>
>>> I don't like any of those solution at the moment.
>>>
>>> And if I define a compilation constant that will tell the compiler if we
>>> are making an executable or not? That way, you will just have to add a
>>> "#If Executable" (or something like that) to compile or not compile the
>>> startup function ?
>>>
>>
>> This is the solution I implemented in revision #4715. Tell me if it fits
>> your needs.
>>
>> Regards,
>>
> Benoît,
>
> I'm trying it but I need a bit of help on usage.  (I'm using a library
> that has a startup form not a module.  Is this a bad idea?)
>
> Public Sub Form_Open()
>
> #If Executable
>    Me.Center
>    LoadInfos
> #Else
>    Error "This is a library.\nPlease do not run it directly"
>    Message.Title = "Don't do that!"
>    Message.Error("This is a library.\nPlease do not run it directly",
> "OK")
>    Quit
> #Endif
>
> End
>
> If I compile the project and run it via gbx3, I get the expected "Don't
> do that" messages, but if I run it in the IDE I get the same thing.
>
> Bruce
>

The constant is "Exec". I try to use Gambas keywords, because it is 
easier for the preprocessor (that is not entirely finished).

Regards,

-- 
Benoît Minisini




More information about the User mailing list