At the very least he could have provided the C function prototype he's trying to pass a string to
I was trying to call wsock32.dll gethostbyname. From
Windows Sockets Network Programming:
Code: Select all
struct hostent FAR * PASCAL FAR gethostbyname /* Null on failure */
(char FAR *name); /* pointer to name of the host */
If that means something to you, great. I am not a C programmer.
and FB will pass a ptr to the string's contents. I'm not sure why DamageX would think that declaring it as STRING would work... other languages usually don't know how to deal with an FB string descriptor
I was not aware of how to tell whether FB passes a pointer to a string or a pointer to a descriptor, at first I didn't even know it passed a pointer to a descriptor. That's what my question was about. It seems to depend on several details. For instance, in addition to what has already been mentioned, it also seems that @"
www.freebasic.net" is a pointer to the string, and @stuff can be a pointer to the string if it is DIMed as STRING*20 instead of just STRING.
I wanted to pass a pointer because I wanted the function to read from a location other than the beginning. Specifically, if I have stuff="
http://www.freebasic.net" I wanted to pass a pointer to "
www.freebasic.net" and skip the "http://"
Needless to say, when I tried gethostbyname(@stuff+7) it ALWAYS failed.
Hopefully, this discussion thread is now a little more clear :)