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


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to