Re: passing strings to .DLL calls --- (Help!)

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

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...blink
>
>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

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

Search



Quick Links

User menu

Not signed in.

Misc Menu