Re: Sequence-Atom-DLL
- Posted by Robert Craig <rds at RapidEuphoria.com> Jun 02, 2003
- 406 views
jbrown105 at speedymail.org wrote: > On Mon, Jun 02, 2003 at 05:34:53PM -0400, Robert Craig wrote: >>When calling a .dll routine that's written in Euphoria, >>you can pass any kind of Euphoria data as arguments to >>the routine, but you must declare the routine using >>define_c_proc/func and the E_ types (E_INTEGER, E_ATOM, ...), >>not the C_ types (C_INT, ...). >>e.g. >> fc = define_c_proc(lib, "File_Compress", >> {E_SEQUENCE, E_SEQUENCE, E_SEQUENCE}) >> >> c_proc(fc, {"infile.dat", "outfile.dat", {1,2,3}}) > > Just wondering ... if i wrote a C program, and wanted to use an Eu .dll > in it ... how would I call the Eu routine in the translated .dll, and how > would I pass it the parameters? It's pretty easy as long as the Euphoria routine is declared with integer parameters (only), and it returns an integer as a result (if anything). It will look just like a C routine that takes int's and returns an int. A C program (after dynamically linking with the Euphoria .dll) could pass int's, up to 31-bits in size and get back a 31-bit int as a result. C and Euphoria agree on the meaning of integers up to 31-bits. Anything else is incompatible. Someone who studied the internal representation of sequences, might be able to allocate and construct a sequence in C, and pass it in, but that's definitely not for the faint of heart. Regards, Rob Craig Rapid Deployment Software http://www.RapidEuphoria.com