1. RE: euFAQ request for comment
Ray Smith wrote:
> Hi,
>
> I have "started" getting a FAQ ready for Euphoria and was hoping a
> few people can check out my initial few Questions/Answers.
>
> To have a preview look at:
>
> http://rays-web.com/test/eufaq.htm
>
> I'm just after some global type comments at this stage.
>
> Note: The rest of my site isn't ready yet so don't be surprised to
> see very little else by following any links! :)
>
> Thanks,
>
> Ray Smith
> http://rays-web.com
>
Looking Good Ray,
I think that you should point out that those are your opinions. In
particular 1.7. Everyone will have a different opinion of what features
are prevelant and which are missing.
I don't agree that EU lacks OOP. It lacks native OOP support, but
there are quite a few good OOP libraries in the archives. Same for DB
support, but I don't even agree that it should be supported natively.
I think cdecl_ DLL support should be in there, and COM support.
Chris
2. RE: euFAQ request for comment
Thanks Chris,
I'll incorporate your suggestions.
Ray Smith
http://rays-web.com
Chris Bensler wrote:
> I think that you should point out that those are your opinions. In
> particular 1.7. Everyone will have a different opinion of what features
> are prevelant and which are missing.
>
> I don't agree that EU lacks OOP. It lacks native OOP support, but
> there are quite a few good OOP libraries in the archives. Same for DB
> support, but I don't even agree that it should be supported natively.
>
> I think cdecl_ DLL support should be in there, and COM support.
3. RE: euFAQ request for comment
> -----Original Message-----
> From: Chris Bensler [mailto:bensler at mail.com]
> I think that you should point out that those are your opinions. In
> particular 1.7. Everyone will have a different opinion of
> what features
> are prevelant and which are missing.
>
> I don't agree that EU lacks OOP. It lacks native OOP support, but
> there are quite a few good OOP libraries in the archives. Same for DB
> support, but I don't even agree that it should be supported natively.
>
> I think cdecl_ DLL support should be in there, and COM support.
Which are also supported through libraries in the archives. :)
Matt Lewis
4. RE: euFAQ request for comment
> -----Original Message-----
> From: euman at bellsouth.net [mailto:euman at bellsouth.net]
> Matt its unfortunate that CDECL support doesnt work....
> let me rephrase that, I cant get it to work so I doubt a
> newby will. although, I think my problem with your library
> is because my .dll is compiled as Diamond-API which may
> be totally different than a standard cdecl.
Hmmm. From our previous discussions, I got the impression that the calls
were succeeding (i.e., not crashing), but that for some reason, you couldn't
get the dll to perform as documented. Or perhaps the calls didn't success
because they were returning structures. But rereading Rob's post about
structures:
"__cdecl:
- Floating-point values are returned in the same way as structures.
When a structure is returned, the called routine allocates
space for the return value and returns a pointer to the
return value in register EAX.
__stdcall:
- When a structure is returned, the caller allocates space on the
stack.
The address of the allocated space will be pushed on the stack
immediately before the call instruction. Upon returning from the
call, register EAX will contain address of the space allocated
for the return value. Floating-point values are returned in
80x87 register ST(0)."
I don't understand why my cdecl routines would fail (which doesn't really
mean anything, of course :). My understanding is that the return value is
always passed in EAX, and that's how my code operates. Either way, you
should get a pointer to the structure.
I don't entirely understand the part about stdcall structure passing (sorta
sounds like it's been taken out of context). It sounds like you have to
pass an additional pointer to the space where you want the structure to
reside in memory. But this implies that you're getting a bitwise copy of a
structure, rather than a reference (pointer) to it. So my code might fail
in the stdcall implementation, but should succeed for cdecl. This sounds
like its also compiler specific.
I suppose I'll have to play around with my dll to return a structure to see
what the difference is. Maybe Andy (Serpa) can chime in. You've reported
that the cdecl works with your regex dll, right? Is there any structure
passing there? I'll also try passing structures using stdcall. If the
above is correct, it should crash due to corrupted stack problems if the
caller doesn't allocate space.
Every time I start thinking real hard about cdecl/stdcall, I get dizzy...
Matt Lewis
5. RE: euFAQ request for comment
> I suppose I'll have to play around with my dll to return a structure to
> see
> what the difference is. Maybe Andy (Serpa) can chime in. You've
> reported
> that the cdecl works with your regex dll, right? Is there any structure
> passing there? I'll also try passing structures using stdcall. If the
> above is correct, it should crash due to corrupted stack problems if the
> caller doesn't allocate space.
>
Yeah, it works with regex no problem, but I'm actually no longer using
it with that because we figured out how to compile a stdcall .dll for
that one. And the return calls were just integers or pointers to
strings -- no structures.
I also am using your cdecl library with the sqlite wrapper, and it works
fine there.
I'm surprised I didn't think of doing it your way before -- using
LoadLibrary, etc because in my other solution -- the "middleman" .dll --
that is exactly what I did, except in C in a separate .dll. (By the way,
I was using "LoadLibrary" while you specify "LoadLibraryA" -- what's the
difference?)
He may be right about the way the .dll is compiled -- cdecl & stdcall
aren't the only possibilities -- there is fastcall & other calling
conventions as well...
6. RE: euFAQ request for comment
> -----Original Message-----
> From: Andy Serpa [mailto:renegade at earthling.net]
> I'm surprised I didn't think of doing it your way before -- using
> LoadLibrary, etc because in my other solution -- the
> "middleman" .dll -- that is exactly what I did, except in C in a
> separate .dll. (By the way, I was using "LoadLibrary" while you
> specify "LoadLibraryA" -- what's the difference?)
The 'A' means ASCII rather than Unicode strings ('W' for wide). In C, the
A/W distinction is usually macro'd away based on preprocessor settings as to
whether you're using ASCII or Unicode, but the actual function in the dll
still has the A/W suffix. You can check your .h file where LoadLibrary is
defined.
I also had an idea to try using define_c_var(). This returns the pointer to
an exported variable, and so might return the pointer to an exported
function, as well.
> He may be right about the way the .dll is compiled -- cdecl & stdcall
> aren't the only possibilities -- there is fastcall & other calling
> conventions as well...
True, but I'd expect that most would be either cdecl or stdcall. This is
certainly the case for WinAPI and COM calls (all stdcall by default). Any
other conventions would most likely be compiler specific (I've never heard
of anyone other than Watcom using fastcall, for instance), and typically
reserved (by the coder) for non-exported functions. Most of the XXX_API
macros I've seen in C seem to be the same thing, just there to specify a new
type for compiler-type check purposes (at least that's my Eu-Centric
interpretation of what it does :).
Matt Lewis
7. RE: euFAQ request for comment
Andy Serpa wrote:
>
> > I suppose I'll have to play around with my dll to return a structure to
> > see
> > what the difference is. Maybe Andy (Serpa) can chime in. You've
> > reported
> > that the cdecl works with your regex dll, right? Is there any structure
> > passing there? I'll also try passing structures using stdcall. If the
> > above is correct, it should crash due to corrupted stack problems if the
> > caller doesn't allocate space.
> >
>
> Yeah, it works with regex no problem, but I'm actually no longer using
> it with that because we figured out how to compile a stdcall .dll for
> that one. And the return calls were just integers or pointers to
> strings -- no structures.
>
> I also am using your cdecl library with the sqlite wrapper, and it works
>
> fine there.
>
> I'm surprised I didn't think of doing it your way before -- using
> LoadLibrary, etc because in my other solution -- the "middleman" .dll --
>
> that is exactly what I did, except in C in a separate .dll. (By the way,
>
> I was using "LoadLibrary" while you specify "LoadLibraryA" -- what's the
>
> difference?)
Alot of routines in the win32 API have two versions, some with an A
suffix, others with a W suffix. 'A' signifies a routine that accepts
ASCII(byte) strings, where 'W' is WIDE(word) strings.
LoadLibrary is an alias for either LoadLibraryA or LoadLibraryW. Most
likely the first.
If you look at the win32 header files, you will see alot of this:
typedef VOID LOADLIBRARYA;
typedef VOID LOADLIBRARYW;
#ifdef UNICODE
typedef LOADLIBRARYW LOADLIBRARY;
#else
typedef LOADLIBRARYA LOADLIBRARY;
#endif
Chris
8. RE: euFAQ request for comment
Hi Euman,
This is a bit big for a FAQ!!!!
Does anyone know if this article is on a web page somewhere that the
FAQ can link to???
Is Ralf still about???
Maybe I (or someone else?) can put this article on a web page
somewhere with Ralf's permission??
Ray Smith
http://rays-web.com
9. RE: euFAQ request for comment
Ralf's Euphoria web page is no more it seems, nor have we heard anything
from him for quite some time.
The article is archived on the RDS website:
www.rapideuphoria.com/euphoria.htm
and Pete Eberlein has a copy at:
http://www.harborside.com/~xseal/euphoria/RalfEuphoria.html
-- Brian
Ray Smith wrote:
> Hi Euman,
>
> This is a bit big for a FAQ!!!!
>
> Does anyone know if this article is on a web page somewhere that the
> FAQ can link to???
>
> Is Ralf still about???
> Maybe I (or someone else?) can put this article on a web page
> somewhere with Ralf's permission??
>
> Ray Smith
> http://rays-web.com
>
>