passing byref to lib proc

Just starting out? Need help? Post your questions and find answers here.
harkon
Enthusiast
Enthusiast
Posts: 217
Joined: Wed Nov 23, 2005 5:48 pm

passing byref to lib proc

Post by harkon »

I'm working on a project where I needed a TWAIN interface. I'm using EZTWAIN. It comes in a .dll and with a static Lib. I've decided, maybe in error, that it was simpler for me to just use the .lib, that way I would not need to add a dependency to the final product.

For several functions the VB call to the .DLL looks like this;

Code: Select all

Declare Sub TWAIN_ReadRow Lib "eztw32.dll" (ByVal hdib As Long, ByVal nRow As Long, ByRef prow As Any)
My PB code looks like this inside of the Import "EZTW32.LIB" / EndImport;

Code: Select all

DIB_ReadRow(hdib.l, nRow.l, prow.??) As "_DIB_ReadRow@12"
Okay, obviously .?? ain't right, so my question is how do I make this work. How do I duplicate the functionality of "ByRef variable As Any"
I have most everything working and it works really well so this is my first stumbling block in making this somewhat complete.

TIA

*EDIT*
The VB call is actually wrong it should not be TWAIN_ReadRow because that function does not exist, it does work as DIB_ReadRow though. It was a typo in their given example.
Missed it by that much!!
HK
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: passing byref to lib proc

Post by srod »

prow.i would seem correct. Just make sure that when you call the function you then pass a suitable address in lieu of this parameter.
I may look like a mule, but I'm not a complete ass.
User avatar
ts-soft
Always Here
Always Here
Posts: 5756
Joined: Thu Jun 24, 2004 2:44 pm
Location: Berlin - Germany

Re: passing byref to lib proc

Post by ts-soft »

Code: Select all

DIB_ReadRow(hdib.i, nRow.l, *prow)
harkon
Enthusiast
Enthusiast
Posts: 217
Joined: Wed Nov 23, 2005 5:48 pm

Re: passing byref to lib proc

Post by harkon »

Thanks guys, it's way too easy.
Missed it by that much!!
HK
Post Reply