Codesnippets > Inline / 3rd party

DLL help

(1/6) > >>

Ok I omit defeat with the inline command the problem is I just can’t work how it works, I even have the full description file from the supplier. If I send you the dll and the document, can you show me how to get one or two of the commands working, I am sure if you show me one or two I could work out the rest out!

Thanks, Max…

Problem is solved, COM port communication is working. See best answer here:

Ok you asked for it, heres an example :)

Ok that’s great!

Can we start with the simple stuff, I have loads more questions.

1, a Dll file will give GLBAISC extra commands? True/false
2, can I use the commands as if they were part of the glbasic
3, how do variables connect with glabsic variables?

thanks, Max

Kitty Hello:
I got your mail. Oh boy. That's a lot of work. I tell you the basics, but I can't do it all for you.

If you read Visual Basic:

--- Code: (glbasic) ---Private Declare Function XY Lib "xyz.dll" (a As Long) As Double
--- End code ---
You write:

--- Code: (glbasic) ---INLINE
extern "C" double (__stdcall* XY)(long a)=0;
DLLCALL("xyz.dll", "XY", (void**) &XY);
--- End code ---
Now the details:
INLINE - that starts inline C++ programming

Then comes the function declaration - tell the compiler, there is a function called XY that takes a 'long' argument and returns a double.

extern "C" - the call is an extern "C" declaration - for VB callable DLLs it's always this:
extern "C" return_value(__stdcall* FunctionName) (arguments);

--- Code: (glbasic) ---double - that's the return value. Use these:
int - 32 bit integer - the same as 'long'
short - 16 bit integer (that's Integer in VB)
char - 8 bit integer
double - 64 bit floating point
float  - 32 bit floating point
char*  - a String
void*  - any pointer - you can use 'int' as well...
--- End code ---
(__stdcall* - the calling convention. VB can only handle stdcall (double underscore at the beginning)

XY ) - The function name. That's the name you give the function internally (when you call it) It can differ from the real name.

(long a) - here comes the parameter list, separated by commas. You can leave the variable names 'a' if you want to. Only the types are of interest.

=0 - you say the function pointer equals '0'. This way can test if the function got loaded later.

DLLCALL( dll_name, function_name_witin_the_dll, (void**) &function_name_of_declaration);

If you want to call the function, you write:

--- Code: (glbasic) ---LOCAL retval, inval
retval = XY(inval);
--- End code ---
Read the reference for INLINE as well. It tells you how to connect/convert GLBasic data into C++ data.

your the man!, i will try it tonight very slowly. (Sure to have more questions later)

thank you very much for the pointers.


[0] Message Index

[#] Next page

Go to full version