Subject Re: [firebird-support] Re: Defining UDFs for void functions
Author Martijn Tonies
Hi,

> > > How can i define UDFs for void functions ?
> > >
> > > I get an error for this syntax:
> > > "DECLARE EXTERNAL FUNCTION OUTPUTDEBUGSTRING Cstring(64)
> > > ENTRY_POINT 'OutPutDebugString' MODULE_NAME 'kernel32.dll';"
> >
> > You cannot use just any DLL, the function needs to be created with
> > some strict rules.
> >
> > > More specifically, how can i define UDF for OutPutDebugString api
> > > function in kernel32.dll?
> > >
> > > I want to use it in Stored Procedures.
> >
> > Create a wrapper external function library and let your function
> > return a simple integer or so.
> >
>
> Thanks for infos,
> Can i ask why there is a such restriction ?

Well, for starters, memory can be allocated by the routine and
disposed by the Firebird server. But this does mean they need
to have the same memory allocator.

Then there's the whole calling convention thingy.

Certain data-type related structures that can be passed to an
external function.

Etc...

> I am using OutPutDebugString for obtaining some informations from
> stored procedures via listener program (debugview from sysinternals).
> i thought even it would be possible to listen messages with in a rad
> ide with embedded server.
> Now, I will write my own dll for this purpose, which looks very easy
> to do.

Yes, it is, and will be easier for you in such a way that you can deploy
it to your /udf folder and Firebird can always find it.

> Btw Martjin,
> I am curious about how did u implement debugging abilities for
> Sp/triggers in DBworkbench. Does Firebird have api functions for
> debugging?

No, it doesn't -- the debugger emulates the server and executes each
statement on its own.

Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Oracle &
MS SQL Server
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com