03-06-2005, 12:34 AM
Hi!
I try to call function in freeBAsic dll from RapidQ Basic.
AddNumbers example works good, but my function that pass string as parameter is not working:
FB dll code
In RapidQ
If
print "tstr=" ;tstr
is commented in dll code all working good and function return 5.
If print "tstr=" ;tstr uncommented - error occures
Exception EAccessViolation in module MYDLL1.DLL at 0000161A.
Access violation at address 1000161A in module 'MYDLL1.DLL'. Read of address 61616161.
Another words when I don't accces to tstr var - all works good.
There are not problem, when I call it from FreeBasic. My function teststr works good.
2. Also as I see real name in dll is teststr@4, where 4 - parameters length (?). Why it's =4 when string is passed? Is passed pointer to string ?
3. Can I see example how to use cdecl in dll?
In export.bas example I have found
--
But error occures, when I try to use it in dll code
Sorry for my English.
I try to call function in freeBAsic dll from RapidQ Basic.
AddNumbers example works good, but my function that pass string as parameter is not working:
FB dll code
Code:
'****************************'
declare function teststr lib "mydll1" alias "teststr" ( tstr as string ) as integer
[...] '
function teststr ( tstr as string ) as integer export
'print "tstr=" ;tstr
dim b as integer
b=5
teststr=b
end function
In RapidQ
Code:
declare function teststr lib "mydll1" alias "teststr@4" ( tstr as string ) as integer
print "teststr=" ;teststr ("aaaasddf")
If
print "tstr=" ;tstr
is commented in dll code all working good and function return 5.
If print "tstr=" ;tstr uncommented - error occures
Exception EAccessViolation in module MYDLL1.DLL at 0000161A.
Access violation at address 1000161A in module 'MYDLL1.DLL'. Read of address 61616161.
Another words when I don't accces to tstr var - all works good.
There are not problem, when I call it from FreeBasic. My function teststr works good.
2. Also as I see real name in dll is teststr@4, where 4 - parameters length (?). Why it's =4 when string is passed? Is passed pointer to string ?
3. Can I see example how to use cdecl in dll?
In export.bas example I have found
Code:
function AddNumbers cdecl alias "AddNumbers" ( byval operand1 as integer, byval operand2 as integer ) as integer export
But error occures, when I try to use it in dll code
Sorry for my English.
ith best regards, Andrew Shelkovenko.
http://www.wildgardenseed.com/RQDP/FreeBasic/index.html - FreeBasic documentation Project
http://www.wildgardenseed.com/RQDP/FreeBasic/index.html - FreeBasic documentation Project