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

Bruce Bruen bbruen at ...2308...
Sat May 5 04:49:42 CEST 2012


On Sat, 2012-05-05 at 03:59 +0200, Benoît Minisini wrote:
> 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 :
> >>>
> >>> ...
> >>>
> >>> 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.
> >>

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


OK! I got it now, e.g.

Public Sub Main()

  Debug Application.Startup.Name
#If Exec
' This code is executed when running outside the IDE
  Debug "I am the executable"
  Error "Please don't run this file!"
#Else
' This code is only executed when running inside the IDE
  Debug "Not an executable"
  Print "Executing some test code"
' Test1
' Test2
' etc
#Endif

End


Yes, it looks as though this will fit our needs.  I feel that I need to
do some further testing on real example libraries, just to be sure.
(But I have some other things to do now, it's Saturday here. So I'll get
back to you in a few days.)

Bruce





More information about the User mailing list