Re: Euphoria DLLs

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

--=======79C1671C=======

At 09:45 PM 4/22/03 -0400, you wrote:
> > I started on a potentially commercial project that requires this
> > and got stalled by the same thing.  A calling program( language unknown
> > ) is required to pass a pointer to a buffer that it provides to receive
> > an error message.  Sometimes it works; sometimes it doesn't and says "A
> > machine exception occurred ...".  I was wondering if this could be an
> > issue with the page being swapped out at the time but this is not an
> > interrupt service routine. By the way, the program I tested my DLL with
> > is written in Euphoria.
>
>
>You can safely pass *any* Euphoria data (atoms and sequences)
>from a Euphoria program to a Euphoria .dll and back.
>
>I assume you wanted to call the Euphoria .dll from
>a C (or similar) program, and were just testing
>it from a Euphoria program, using define_c_proc() and
>C_INT, C_POINTER etc. parameter declarations, instead of E_INTEGER, E_ATOM 
>etc.

Yes.

>I assume you can edit the main program,
>in which case you can break the buffer pointer
>into *two* 16-bit arguments, pass them separately,
>and then recombine them into a single 32-bit pointer
>(*atom* variable, not integer) in the Euphoria subroutine.
>In C you would do something like:
<snip>

No, I cannot edit the main program because I won't be writing it.  It would 
be developed separately by any number of persons with whom I have no 
contact.  The API of my DLL is specified in a published document.  E.G.:

C / C++ Prototype
extern "C" long WINAPI GetLastError
(
char *pErrorDescription
)

The calling program is required to allocate a buffer and pass a pointer to 
the function in the DLL.  The DLL must then poke a string into the buffer.

         I tried to make a simple example but that ALWAYS fails. ( a clue 
perhaps ? )

         Does anyone know if the buffer allocated by the caller is 
automatically made available (i.e. is given write permission) to the 
DLL?  Could there be some WIN32 API function to lock the memory that I ( or 
perhaps Euphoria's allocate() ) need to call?

         Since I don't have the EU source, I can only guess at what might 
be happening.  As my function often DOES work, I suspect there might be 
some flag that allocate() should use internally in this situation.

         It's just very frustrating to not be able to use my favorite 
language for this.

         Thanks for the reply,

                 Bob     

--=======79C1671C=======
Content-Type: text/plain; charset=us-ascii; x-avg=cert;
x-avg-checked=avg-ok-713B265C
Content-Disposition: inline


---

--=======79C1671C=======--

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

Search



Quick Links

User menu

Not signed in.

Misc Menu