IonicWind Software

Creative Basic => General Questions => Topic started by: REDEBOLT on April 22, 2008, 10:02:25 PM

Title: Using a dll
Post by: REDEBOLT on April 22, 2008, 10:02:25 PM
I have a dll which I moved to the c:\windows\system32 directory.
I am attempting to convert an ebasic program to cbasic.
I have an include file with only consts and declares which I converted to cbasic format.
I created a component from this file.
I included the component in my program.
When I reference a function from the component, I get an error.
If I copy the function declaration to my program, it works.

Can I not do this?
Title: Re: Using a dll
Post by: pistol350 on April 23, 2008, 02:41:47 AM
Hi Bob!

You should have the expected results.
Maybe you are doing something wrong.
How did you include the component in your program ?

Could you show some piece of code ?
Title: Re: Using a dll
Post by: REDEBOLT on April 27, 2008, 01:10:18 PM
Attached is a zip file containing my test codes.
hi_PutRegAdd.eba is a program that works.
It uses ebaHIME.INC.
hi_PutRegAdd.cba is a translation of hi_PutRegAdd,eba.
cba doesn't have an include statement, so I assumed
that I would have to copy the entire include into the source.
Paul corrected me and suggested I use components.
So, I made a component of cbaHIME.INC.
However, it didn't work. 
The component doesn't work like an include file.

Another problem:
The statement at line 48 will not compile.
hi_PutRegAdd(lAdd, lLen, lReg1)
apparently has a problem with lAdd.
The corresponding line in eba works fine.
Title: Re: Using a dll
Post by: pistol350 on April 27, 2008, 02:37:10 PM
Hi Bob!

As i thought, To link components to your main source file you have to do a jump from your source file to the components.
Moreover, the User guide says that components, are just Subroutines.
You may already be aware of that by the way.

So, you can't use your include files as components at their current states, you first need to create a subroutine in which you will put the content of your include files.
It's only then that you will be able to create components from these subs that you will call from the top of your main source file. (as you would do with the"INCLUDE$" statement in Ebasic )

Hope my short speech was clear enough to be understood.  :)