Hello,
even though i'm working a while with Basic4PPC and write since ~ 9 Months on my 5000+ lines project, i still don't understand some concepts of Basic4PPC.This might be due to the fact, that i'm not very familiar with .Net and it's concepts.There's a couple of questions i have, and this is the first one:
- Before i can use an object ( from an external lib) , i need to initialize it.In B4P this is usually done by : someobject.new(1)
- in other languages, i'm used to give the new object a name or a number upon creation, and if successfully created, the object gives back a pointer to it - sometimes.So creation of multiple instances of the same object is not a problem.The use of functions hosted in external libraries does not require to initialize these prior to the use, the compiler just needs to know where the function is located ( include etc.)
- why is this so in B4P...? Before the use of the external lib functions, i add these libs to the components and i also add the objects prior to the compile.So B4P knows everything that's necessary ?
- in B4P, there's no number for the object, so i can open / initialize it only one time ( except all built-in controls, like textbox etc.).I'm asking myself, how i could open 2 or more http requests at the same time using http lib..?
This here:
has no number or indentifier on it.So this must be the one an only request ?
Or can i open another http request by just doing the same like with the first one:
, while the first request is still open ?
Or could i open another http request / object in a thread ?
An even better example is the serial lib:
For me does this clearly mean, that there can only be one comport handled - at a time.You can change the settings, close port and re-open the port, but not for 2 or more ports at the same time.Correct ? Or can this sequence called for more than one comport sequentially ( or even "at the same time" in a thread code) ? Like this ?
I would expect to get an error here ( even though i didn't dare yet ;-) ), because THE serial port is already opened and not closed yet.Some libs appear to make a difference, e.g. threading lib allows to open / call more than one thread a the same time ( at least i believe that ;-) ).Until now this didn't bother me to much, but the more my project is growing, the more these code structures get obstructive.
- What does the .new do ? Is it just to reserve some space in the memory and initialize some arrays/structures needed by the library functions ? So do i need this only one time in a program run or is it gone by the .close and need to be called when the function is used/opened again ? Or do i have to understand the .new like an Open.Whatever() ? At least in the GPSDriver lib i need an .new and then still an Open ? Why does the Open not the job of .new upon first call ? Or is it like Init and Open ? If so, why do i need another response.new after a Response.Close ? Is the .new in http lib like an Init and Open at the same time ? Why do the libs have different concepts ?
I really appreciate if someone can enlighten me somehow
regards,
TWELVE
even though i'm working a while with Basic4PPC and write since ~ 9 Months on my 5000+ lines project, i still don't understand some concepts of Basic4PPC.This might be due to the fact, that i'm not very familiar with .Net and it's concepts.There's a couple of questions i have, and this is the first one:
- Before i can use an object ( from an external lib) , i need to initialize it.In B4P this is usually done by : someobject.new(1)
- in other languages, i'm used to give the new object a name or a number upon creation, and if successfully created, the object gives back a pointer to it - sometimes.So creation of multiple instances of the same object is not a problem.The use of functions hosted in external libraries does not require to initialize these prior to the use, the compiler just needs to know where the function is located ( include etc.)
- why is this so in B4P...? Before the use of the external lib functions, i add these libs to the components and i also add the objects prior to the compile.So B4P knows everything that's necessary ?
- in B4P, there's no number for the object, so i can open / initialize it only one time ( except all built-in controls, like textbox etc.).I'm asking myself, how i could open 2 or more http requests at the same time using http lib..?
This here:
Response.Value = Request.GetResponse
has no number or indentifier on it.So this must be the one an only request ?
Or can i open another http request by just doing the same like with the first one:
Response.New1
Request.New1(URL)
...
Response.Value = Request.GetResponse
...
Response.Close
, while the first request is still open ?
Or could i open another http request / object in a thread ?
An even better example is the serial lib:
serial1.New2 (4,9600,"N",8,1)
serial1.PortOpen = true
For me does this clearly mean, that there can only be one comport handled - at a time.You can change the settings, close port and re-open the port, but not for 2 or more ports at the same time.Correct ? Or can this sequence called for more than one comport sequentially ( or even "at the same time" in a thread code) ? Like this ?
serial1.New2 (4,9600,"N",8,1)
serial1.PortOpen = true
serial1.New2 (5,9600,"N",8,1)
serial1.PortOpen = true
serial1.New2 (6,9600,"N",8,1)
serial1.PortOpen = true
I would expect to get an error here ( even though i didn't dare yet ;-) ), because THE serial port is already opened and not closed yet.Some libs appear to make a difference, e.g. threading lib allows to open / call more than one thread a the same time ( at least i believe that ;-) ).Until now this didn't bother me to much, but the more my project is growing, the more these code structures get obstructive.
- What does the .new do ? Is it just to reserve some space in the memory and initialize some arrays/structures needed by the library functions ? So do i need this only one time in a program run or is it gone by the .close and need to be called when the function is used/opened again ? Or do i have to understand the .new like an Open.Whatever() ? At least in the GPSDriver lib i need an .new and then still an Open ? Why does the Open not the job of .new upon first call ? Or is it like Init and Open ? If so, why do i need another response.new after a Response.Close ? Is the .new in http lib like an Init and Open at the same time ? Why do the libs have different concepts ?
I really appreciate if someone can enlighten me somehow
regards,
TWELVE