1. passing strings to .DLL calls --- (Help!)
Robert, David, Pete, Daniel, Irv,... or any other expert in interfacing to
windows .DLLs:
A basic question on DLL interfacing:
I see clearly that when I have to pass a "C" structure to a routine inside a
DLL, I have to allocate some memory space, and poke in the desired values.
The same when I need to get some data from inside an structure.
But, what does happen with sequences?. Are sequences equivalent to
C_POINTER?.
How should I pass a sequence to a .DLL string?. And backwards?.
BTW, I've got a functional wrapper for the Winsock 32 DLL. I've coded most
of the constants (from Winsock.h and other sources), and successfully
implemented the WSAStartup and WSACleanup procedures, so I've got a kind of
Which-Winsock- version-you-have program.
Not too ellaborate to release it yet, but it does promise me a lot.
The output on a console box (socket debugging feature) gives a short info
about the current winsock 32.
(if anyone interested, please ask).
I'm planning to implement the basics for my socket driven client-server
thermometer for the alpha release.
The thermometer program would be the server. Any (reasonable) number of
clients will be able to ask for the temperature concurrently.
If I can get rid of some conceptual troubles I have now, may be ready
quickly.
(Not as quick as David or Irv ones anyway...
Thanks for your help.
Jesus.
2. Re: passing strings to .DLL calls --- (Help!)
-----Original Message-----
De: JesusC - Jesus Consuegra <jconsuegra at REDESTB.ES>
Para: EUPHORIA at cwisserver1.mcs.muohio.edu
<EUPHORIA at cwisserver1.mcs.muohio.edu>
Fecha: lunes 29 de junio de 1998 18:51
Asunto: passing strings to .DLL calls --- (Help!)
>Robert, David, Pete, Daniel, Irv,... or any other expert in interfacing to
>windows .DLLs:
>
>A basic question on DLL interfacing:
>
>I see clearly that when I have to pass a "C" structure to a routine inside
a
>DLL, I have to allocate some memory space, and poke in the desired values.
>The same when I need to get some data from inside an structure.
>But, what does happen with sequences?. Are sequences equivalent to
>C_POINTER?.
>How should I pass a sequence to a .DLL string?. And backwards?.
You can't pass an Euphoria sequence just like that. But if you want to pass
a string, implemeted in Euphoria as a one dimension sequence, you can do it
easily by just allocating length(s)+1 bytes (s is your string) and poking to
the allocated memory your string, ending with a 0 (zero), that's why you
need to allocate +1 bytes ;)
You then give the dll functions the address of the allocated memory as the
parameter.
Regards,
Daniel Berstein
daber at pair.com
3. Re: passing strings to .DLL calls --- (Help!)
- Posted by Jacques Deschenes <desja at GLOBETROTTER.QC.CA>
Jun 29, 1998
-
Last edited Jun 30, 1998
At 23:50 29-06-98 +0300, you wrote:
>Robert, David, Pete, Daniel, Irv,... or any other expert in interfacing to
>windows .DLLs:
>
>A basic question on DLL interfacing:
>
>I see clearly that when I have to pass a "C" structure to a routine inside a
>DLL, I have to allocate some memory space, and poke in the desired values.
>The same when I need to get some data from inside an structure.
>But, what does happen with sequences?. Are sequences equivalent to
>C_POINTER?.
>How should I pass a sequence to a .DLL string?. And backwards?.
>
>BTW, I've got a functional wrapper for the Winsock 32 DLL. I've coded most
>of the constants (from Winsock.h and other sources), and successfully
>implemented the WSAStartup and WSACleanup procedures, so I've got a kind of
>Which-Winsock- version-you-have program.
>Not too ellaborate to release it yet, but it does promise me a lot.
>The output on a console box (socket debugging feature) gives a short info
>about the current winsock 32.
>(if anyone interested, please ask).
>
>I'm planning to implement the basics for my socket driven client-server
>thermometer for the alpha release.
>The thermometer program would be the server. Any (reasonable) number of
>clients will be able to ask for the temperature concurrently.
>
>If I can get rid of some conceptual troubles I have now, may be ready
>quickly.
>(Not as quick as David or Irv ones anyway...
>
>Thanks for your help.
>Jesus.
>
To pass a string to c function use allocate_string()
example
atom pStr
pStr = allocate_string("hello Jesus") -- allocate string zero pointer
TextOut(hDC,x,y, pStr,length("hello Jesus")
to peek a string sero use a function like this one.
function peeksz(atom pStr)
sequence string
integer c, i
string = {}
c = peek(pStr)
i = 0
while c do
string = string & c
i = i + 1
c = peek(pStr + i)
end while
return string
end function
Jacques Deschenes
Baie-Comeau, Quebec
Canada
desja at globetrotter.qc.ca