Re: Sequence-Atom-DLL
- Posted by Elliott Sales de Andrade <quantum_analyst at hotmail.com> Jun 03, 2003
- 399 views
>From: Derek Parnell <ddparnell at bigpond.com> >Subject: Re: Sequence-Atom-DLL > > >On Mon, 02 Jun 2003 19:31:53 -0400, Robert Craig <rds at RapidEuphoria.com> >wrote: > >> >>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. > >Just to clarify, does this also mean that 32-bit addresses might pose a >problem? And what about flags bits such as #8F12817F ? If you want it to receive possible 32-bit values, try reading this: http://logicsoft.pcplayground.com/modules.php?name=FAQ&myfaq=yes&id_cat=3&categories=Euphoria+and+Other+Programming+Languages >>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. >> > >So normally we need to convert a sequence to some form of RAM structure and >pass an address instead? -- Derek > Can't help you there.