ServiceFB - Event-driven NT Service framework

User contributed sources that have become inactive, deprecated, or generally unusable. But ... we don't really want to throw them away either.
Post Reply
zerospeed
Posts: 227
Joined: Nov 04, 2005 15:29

ServiceFB - Event-driven NT Service framework

Post by zerospeed »

Hello FB users!,

ServiceFB simplify programmers work when creating NT Services using FreeBASIC as programming language. It also encapsulate most of the Win32 API and provide a clean event-driven like interface.

UPDATES

* 2007-02-12 - Version 0.3.0 is released!
*0.3.0* (February 12, 2007)

* ServiceFB is now under MIT license.

* No log file (service.log) will be created unless SERVICEFB_DEBUG_LOG is defined.
That will trim a bit the reported information
README: here
CHANGELOG: here

Downloads:
Version 0.3.0 (Source): servicefb-0.3.0.zip (36Kb)

Licensing:
ServiceFB is now licensed under MIT license. You could use ServiceFB in free or commercial projects as long copyright notice remain unchanged.

SVN Access:
ServiceFB is now at Google Code!

This project is hosted in a public, open SVN (subversion) repository, in case others want to contribute or get updates using it.

NOTES
* It takes advantage of features available in beta 0.17 of FreeBASIC (tested only agaisnt night-build from anonymous1337).
* Also, its build with fb lang (no deprecated) so your code must comply with the new standards.

Feedback welcome,

Zero
Last edited by zerospeed on Feb 13, 2007 13:50, edited 3 times in total.
zerospeed
Posts: 227
Joined: Nov 04, 2005 15:29

Post by zerospeed »

New Update!

Until management and simulation of services arrive, a few improvements were added into the repository:
* More detailed documentation about using the library

* Reimplemented the way fb.svc handles services, allowing now multiple services run from the same process.

* Implemented ServiceHost: handling of multiple services from the same process (shared). Refer to sample/multiservice.bas

All these changes are avaible at the same URL: OpenSVN Repository

Version 0.2 will be released soon after management code is checked in.

Feedback and suggestions are welcome.

Regards,

Zero
v1ctor
Site Admin
Posts: 3804
Joined: May 27, 2005 8:08
Location: SP / Bra[s]il
Contact:

Post by v1ctor »

Well done, i remember playing with SCM years ago, in assembly :).

I was checking the rake script too, it looks much more logical compared to make, gotta evaluate it soon - not for the FB sources though.
zerospeed
Posts: 227
Joined: Nov 04, 2005 15:29

Post by zerospeed »

v1ctor wrote:Well done, i remember playing with SCM years ago, in assembly :).

I was checking the rake script too, it looks much more logical compared to make, gotta evaluate it soon - not for the FB sources though.
Thank you for your comment v1ctor, and for being the first one! ;-)

Rake is a powerful 'make' used by ruby, and you could see the flexible it could get :-)

I'm going to improve the ProjectTask syntax used in the Rakefile (the source for the code is in rakehelp/freebasic).

I hope get a syntax similar to this:

Code: Select all

# for executables (no need for extension)
project_task 'my_service' do
  executable  'my_long_executable_name'
  #library     'my_lib_name'
  #dynlib      'my_dll_so_name'
  target_path 'bin'
  
  version     '1.0.1'
  
  main        'my_service/main.bas'
  source      'a_module_file.bas', 'another_module.bas'
  source      'several_other_files.bas'
  
  # also could use source wildcard!
  source      'src/**/*.bas' 
  
  library     'user32', 'advapi32'
end
this create a few tasks:
my_service:build, clobber and rebuild

build compile only the files needed to be compiled, and will recompile the ones changed. clobber will clear the compiled versions of the files and rebuild perform the both actions in chain for a clean compilation (clobber, build)

Also, it add a global build/rebuild/clobber tasks that do everything for all the projects defined in the Rakefile.

Is more cleanner than ' ProjectTask.new (...) do |p| ' syntax :D
(and more easy to understand than make :P

OTOH, what do you think about the layout, naming convention and implementation?
zerospeed
Posts: 227
Joined: Nov 04, 2005 15:29

Post by zerospeed »

OK, instead of 'hopes' the new syntax for Rakefile is available:

Code: Select all

project_task 'myprogram' do
  executable  'MyProgram'
  build_to    'bin'

  main        "src/main.bas"
  source      "src/module1.bas", "src/module2.bas", "src/module3.bas"
  
  lib_path    'lib'
  library     'mylib'
  library     'user32'
end
As usual, for the one interested in this Ruby-make (Rake) check the code from OpenSVN Repository rakehelp subdirectory of trunk.
zerospeed
Posts: 227
Joined: Nov 04, 2005 15:29

Post by zerospeed »

UPDATE:

Now on SVN repo, revision 18:
* Added automatic loading of definitions (include file) for ServiceFB Utils namespace
Use #define SERVICEFB_INCLUDE_UTILS
Also must link with ServiceFB_Utils.bas

* Coded console mode for debugging and testing of services (one or many)
Please check the source files in samples folder.
Checkin management code soon, so release 0.2 of ServiceFB is near!
zerospeed
Posts: 227
Joined: Nov 04, 2005 15:29

Post by zerospeed »

Version 0.2 is out!

Updated the first post with new information and download link!

Please, take a look there and post your comments.

Later,

Zero
cha0s
Site Admin
Posts: 5319
Joined: May 27, 2005 6:42
Location: USA
Contact:

Post by cha0s »

Cool ^^
zerospeed
Posts: 227
Joined: Nov 04, 2005 15:29

Post by zerospeed »

Hello Forum!

ServiceFB made some progress (0.3.0 version) and home moving to Google Code!

Also code is now MIT License compatible, you could could feel safe using it ;-)

Please refer to the first post for detailed information about it.

Don't hesitate on leave comments and suggestions.

Zero
vkthakur
Posts: 7
Joined: Jan 07, 2009 4:05
Location: India
Contact:

Re: ServiceFB - Event-driven NT Service framework

Post by vkthakur »

Hi guys I've updated to the latest version of FB now its giving this error in compiling ServiceFb code. Please let me know how to fix this. Now I'm using FB after a while here is the compiler error

_internals.bi(20) error 3: Expected End-of-Line, found 'constructor' in 'declare sub _initialize() constructor'
_internals.bi(21) error 3: Expected End-of-Line, found 'destructor' in 'declare sub _terminate() destructor'
vdecampo
Posts: 2992
Joined: Aug 07, 2007 23:20
Location: Maryland, USA
Contact:

Re: ServiceFB - Event-driven NT Service framework

Post by vdecampo »

Constructor/Destructor are reserved words. Looks like there should be a remark symbol (') before the words.

-Vince
Tourist Trap
Posts: 2958
Joined: Jun 02, 2015 16:24

Re: ServiceFB - Event-driven NT Service framework

Post by Tourist Trap »

Didn't know about module constructors.
Last edited by Tourist Trap on Apr 20, 2016 17:27, edited 1 time in total.
fxm
Moderator
Posts: 12106
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: ServiceFB - Event-driven NT Service framework

Post by fxm »

Module constructor must be declared only at the definition level (not at the declaration level):

Code: Select all

declare sub _initialize()

sub _initialize() constructor
  '.....
end sub
Corrected in version 1.00.0:
- #726: CONSTRUCTOR|DESTRUCTOR (module-level initialization/cleanup) was allowed to be specified on sub prototypes (although, it was ignored), method bodies (silently miscompiled due to the missing THIS argument), and PRIVATE/PROTECTED static member procedures. Now these cases are disallowed.
zerospeed
Posts: 227
Joined: Nov 04, 2005 15:29

Re: ServiceFB - Event-driven NT Service framework

Post by zerospeed »

ServiceFB hasn't been updated in years and don't think is worth to update all that codebase.

After the shutdown of Google Code, you can find the code on GitHub:

https://github.com/luislavena/servicefb

However I recommend using something smaller like mini_service instead:

https://github.com/luislavena/mini_service

But that also requires updates to latest version.

Free free to send a pull request with changes.

Cheers.
vkthakur
Posts: 7
Joined: Jan 07, 2009 4:05
Location: India
Contact:

Re: ServiceFB - Event-driven NT Service framework

Post by vkthakur »

thanx 4 quick reply guys. I think now I should go with mini service...
Post Reply