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

Bruce Bruen bbruen at ...2308...
Sat May 5 03:42:21 CEST 2012


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





More information about the User mailing list