RE: Return a Sequence from A DLL?

new topic     » topic index » view thread      » older message » newer message

> -----Original Message-----
> From: Jonathan Leger [mailto:jleger at amerisafe.com]

> I am new to Euphoria, and I am interested in writing a library
> for Euphoria that will allow passing SQL statements to MS SQL Server.
> The language is incredible, but my company uses SQL Server as its
> backend (and ODBC is just too darn slow).
>
> What I'd like to know is: what is the structure of a Euphoria
> sequence?  How can I return that structure from a 3rd party DLL?

Welcome to the list!

I don't think you'll be able to do what you want, although you might not
need to.  Rob's said many times that he might change the internal handling
of sequences, and so doesn't want anyone writing code to manipulate things
at such a basic level.  (Of course, now you could buy the source and do it
anyway.)

If you're trying to pass a sequence to a DLL written in Euphoria (and
translated/compiled), you can do this now under 2.3 (I think--but I haven't
upgraded yet).  You could also check out sequence.e in the archives.  I
translated Rob's sequence compression technique from EDS to work with
memory.  You could compress and decompress into sequences this way.

However, I suspect that what you need to do is pass a string to SQL Server.
This is a lot easier.  There are a couple of alternatives, depending on the
type of string you'll be using.  It should be easy, unless you need to pass
unicode, which would complicate things a bit.  Here's how you pass a normal
zero terminated string to a DLL:

-- code
sequence string
atom ptr

string = "I'm going to pass this sentence."

ptr = allocate( length( string ) + 1 )
poke( {ptr, string & 0} )

-- assuming you've already linked to the DLL
c_proc( the_dll_proc, { ptr } )

free( ptr )
-- end code

Hopefully, this will get you started.

Matt Lewis

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu