Some basic questions

Blitz3D Forums/Blitz3D Userlibs/Some basic questions

jfk EO-11110(Posted 2005) [#1]
Some things I tend to forget frequently and I cannot find an official documetation of it, maybe because it's considered trivial by C coders:

What are the varibles in userlibs?
I know: a or a% is a 32 Bit int argument.
I also know a* is a pointer to a blitz bank.
I've seen a$ - what's that, I guss not a string since strings must be transfered over banks?
And how do I declare a boolean flag, like true/false/null ?

I have also realized that using a function name like "_dothisandthat()" in the userlib (a typical newbie mistake) will stop Blitz3D from running until this leading underscore is removed in the userlib file.

Then I really don't know what I'm doing wrong, but blitz always tells me "user lib not found", although I have copied it to 3 folders: current app folder, uselibs folder and even the windows system folder. Also the name is written correctly in the userlib: .lib "openvip_hl.dll". I've also restarted the Blitz IDE (tho this shouldn't be neccessary with the current Blitz version).

I declare the functions one by one, and right now all I try is
openvip_create%() and openvip_destroy(lib%)
to test the basic initialisation, but even here it says "user lib not found". What could be the cause for this?

For the openvip library see my other thread about openvip.

Thanks.

EDIT I just tested it with CallDLL and it seems to work, at least the two mentioned function. Of course it doesn't make much sense with CallDLL.

EDIT2:
Ok, it turned out I had to add the "upl.dll" whatever this is, it seems to be used by openvip_hl.dll internally (wasn't mentioned anywhere). the function openvip_create() works now, but openvip_destroy still produces a "User lib function not found" error. This function is described in the docs, as well as it is referenced in the highlevel_api.h that contains a list of all public functions of the highlevel api. What drives my crazy is the fact that even when I try to find the string "openvip_destroy" in anyone of the files in the openvip folder, it cannot be found, just like the docs are trying to make an april joke.

What does this mean:

///same as openvip_library_t::destroy
#define openvip_destroy(lib) \
lib->destroy(lib)

Does that mean I have to use "openvip_destroy(lib%)" or what?

can this really be that hard?


jfk EO-11110(Posted 2005) [#2]
uh right now I give up, seems like I lack of some fundamental information, like what this "lib->destroy()" stuff means. Maybe someone will enlighten me.


jfk EO-11110(Posted 2005) [#3]
It's always amazing to see the sheer amount of support I get when I need help. Silly as I am this won't stop me from helping other people whenever I can.


KuRiX(Posted 2005) [#4]
Well, do not be so rude... we always help:

a$ -> This a way of passing C Strings, this is, a null terminated string

a* -> A pointer. A pointer is a 32 bit integer indicating a memory position. This can be good to pass structs, banks, pointer to strings, etc...

You cannot declare boolean flags, use integer instead.

i don't understand all your questions, but:
lib->library() indicates a method of the class library called destroy.

The userlib function not found is always that the dll is not present or the decls is not complete.

Be more specific and i will help you. I am good wrapping xD


jfk EO-11110(Posted 2005) [#5]
Thanks Kurix! I had a bad day, I wasn't meant to be rude, but maybe too much pessimistic.

Ok, you just made me remember I have to hack a banks adress before I can use it with the pointer argument (toms method).
So a$ is in fact a string, only a null terminated one. Since blitz strings are not null terminated AFAIK, i take it i have to a$=a$+chr$(0) it.

There are two error messages: Userlib not found and userlib function not found, and they do describe what's going on. I only didn't know that one DLL may require a further DLL and if this second DLL is missing, there may still be this "userlib not found" error.

If you really want to help me, then have a quick look on the package OpenVIP. It's a Video processing library, created for DLL usage, so maybe it's very useful for blitz.

I don't please you to wrap it, although that would be cool, but if you could see if it can be wrapped at all or if there are some basic troubles in the interface (callback things)?

The adress of the sourceforge download page is:
http://sourceforge.net/projects/openvip
The documentation says the file "highlevel_api.h" should contain all neccessary information to access the public functions and methods of the high level dll "openvip_hl.dll". The "highlevel_api.h" lists the function "openvip_destroy", but when I run a text search over all files inside the openvip folder, this string cannot be found in any file but "highlevel_api.h". Nevertheless the documentation states clearly that openvip_create and openvip_destroy are the mandatory basement for every call of the library. This is what's confusing me. Where is this function anyway? Does it exist or is it only me who misunderstood everything once again.


KuRiX(Posted 2005) [#6]
I have received lot of help from this forum, and i think you have helped me too.

I will look into the project and tell you later what i think.

You don't need to add the chr$(0) when passing strings to dll's, this is done automatically. Of course this is a problem because if you want to pass a bank as a string and the bank contains a zero byte, then the string will be cut.

Cheers, KuRi


KuRiX(Posted 2005) [#7]
Well, for what i have been looking, you are not programming a wrapper, you are just creating a .decls file to access the original .dll

This could be a mistake if the dll needs some callback functions. I am reading now the manual, and some callbacks are optional. In other case, what you should do is programming a full wrapper in Visual C (for example) that takes the needed functions and does the callbacks internally...

And OpenVip is NOT for showing video, i see that is for PROCESSING?


jfk EO-11110(Posted 2005) [#8]
Ok, I see. Well thank you very much for your help.

I think processing contains showing, although maybe not in realtime, but that's exactly what is missing in all existing Video solutions for Blitz, but MCISendString (but that is not reliable when it comes to frame access). OpenVIP is capable of delivering single video frames to a given memory adress, in blitz probably a pointer to a bank. And there is this blitz hack that allows to redirect an image to a bank handle, so practically it's possible to physically point to an image.

EDIT: Note to myself (may be useful for other people too):
Read Sweenies How to wrap a DLL Tutorial! :
http://www.blitzbasic.com/Community/posts.php?topic=38319