From: Luis Lavena Date: 2006-03-21T13:00:55+09:00 Subject: Using Rake to compile FreeBASIC code Hello list!, Maybe the subject sound strange, but FreeBASIC (http://www.freebasic.net) offer us native assembly-linked code that we currently use to drive a few special purpose dlls on windows. Folling Rake Tutorial, we tried to recreate it for fb (instead of c). The problem is related in the way FB set the main module on the compiled object (an special param must be passed to make the module as main). In the later link process, if no module is defined/marked as main, the link stop and raise a undefined main routine. We solved this creating an Array of "MAINS", when the compile rule find the module in the list, add the param for making it main. The problem is that in our Rakefile we have several projects, and some of them use these modules but not as main, so it raises a problem of multiple definitions. There is the code we are using: MAINS = [] LIBS = [] rule '.o' => '.bas' do |t| fbc_compile t end def fb_project(executable, main, files, libs=nil) obj = FileList.new(files) obj.include(main) MAINS << main obj.each { |fn| fn.sub!(/.bas$/, ".o") } file executable => obj do |t| fbc_link t, libs end end def fbc_compile(task) as_main = "-m #{task.name.chomp('.o')}" if MAINS.include?(task.name) sh "fbc -c #{task.source} -o #{task.name} #{as_main}" end def fbc_link(task, libs) lb = [] libs.each { |libname| lb << "-l #{libname}" } unless libs.nil? sh "fbc -x #{task.name}.exe #{task.prerequisites.join(' ')} #{lb.join(' ')}" end fb_project("test", "stub.bas", ["**/*.bas", '*.rc'], ["user32"]) task :compile => :test fb_project("xx", "module1.bas", ["module2.bas"], ["user32"]) task :compile => :xx If we call test or xx task (or even compile) module1.bas and stub.bas both get compiled "as main", and the link process fail. Any suggestion or approach to solve this issue? Thanks in advance, Luis -- Posted via http://www.ruby-forum.com/.