You are not logged in. You can browse in the PowerBASIC Community, but you must click Login (top right) before you can post. If this is your first visit, check out the FAQ or Sign Up.
Guys --
That "string" works confirms Lance's idea. (pointer to pointer of ASCIIZ).
What means address of STRING in PB ?
This is an address of pointer, which shows, where located
string data (ASCIIZ).
Pls, test
Code:
#Compile Exe
#Register None
#Dim All
#Include "win32api.INC"
Function PbMain
Dim s(1 : 2) As String, i As Integer, ss As Dword
s$(1) = "abc": s$(2) = "cde"
For i = 1 To 2
ss = CvDwd(Peek$(VarPtr(s$(i)), 4))
MsgBox Hex$(ss) + "/" + Hex$(StrPtr(s$(i))) + "/" + _
Peek$(ss, 3) + "/" + Str$(Peek(ss + 3))
Next
End Function
[This message has been edited by Semen Matusovski (edited March 14, 2000).]
I thought that this means a pointer to a pointer to an ASCIIZ string... ie, two layers of indirection. In PB, you do multiple layers of indirection like this:
'Psuedocode:
DIM a AS ASCIIZ
DIM b AS ASCIIZ PTR
DIM c AS ASCIIZ PTR
b = VARPTR(a)
c = VARPTR(b)
MSGBOX a & $CRLF & @b & $CRLF @@c
DIM argv(5) AS DWORD
argv(0) = VARPTR(Firstsz)
argv(1) = VARPTR(Secondsz)
..
..
glutInit TALLY(@lpCmdLine, " "), VARPTR(argv(0))
------------------
Leave a comment:
Guest replied
Hi Vladimir!
At the moment, we can't get glutInit to work no matter how we declare it.
From glut.h...
extern void APIENTRY glutInit(int *argcp, char **argv);
(And we all know char is ASCIIZ...)
Should be
DECLARE SUB glutInit LIB "glut32.dll" ALIAS "glutInit" (argcp AS LONG, argv AS ASCIIZ)
or
DECLARE SUB glutInit LIB "glut32.dll" ALIAS "glutInit" (argcp AS LONG, argv AS ASCIIZ PTR)
so...
glutInit TALLY(@lpCmdLine, " "), @lpCmdLine
Would be the correct way to call it
But it keeps crashing
GLUTEG caused an invalid page fault in module MSVCRT.DLL at 014f:780264b5.
We are looking into it...
[This message has been edited by Andreas_Allerdahl (edited March 15, 2000).]
In GLUT.INC
'===========================
DECLARE SUB glutInit LIB "glut32.dll" ALIAS "glutInit" (argcp AS LONG, argv AS ASCIIZ)
'============== DON'T WORK !!! - SISTEM ERROR 4
argv must be as string:
DECLARE SUB glutInit LIB "glut32.dll" ALIAS "glutInit" (argcp AS LONG, argv AS STRING)
We process personal data about users of our site, through the use of cookies and other technologies, to deliver our services, and to analyze site activity. For additional details, refer to our Privacy Policy.
By clicking "I AGREE" below, you agree to our Privacy Policy and our personal data processing and cookie practices as described therein. You also acknowledge that this forum may be hosted outside your country and you consent to the collection, storage, and processing of your data in the country where this forum is hosted.
Leave a comment: