IonicWind Software

IWBasic => General Questions => Topic started by: Techno on October 29, 2008, 02:18:42 PM

Title: I can't access to functions in my dll
Post by: Techno on October 29, 2008, 02:18:42 PM
Hi all,

When I try to compile my main they can't access to my dll library.
This is the example that I try to access this functions

I can create with success the test.dll en than the import library and give my no errors.
But when I try to compile my main program with used the functions of my dll it fails


export myfunction
export myfunction2
export INTRAND

SUB myfunction(in as INT),INT
RETURN in * 100
ENDSUB

SUB myfunction2(),INT
RETURN 0
ENDSUB

SUB INTRAND(min as INT,max as INT),INT
RETURN RAND(min,max)
ENDSUB



/* The main program */

$use "dll_test.lib"
$include "dll_test.inc"
OPENCONSOLE
DEF x    AS INT : x = 500
DEF Result AS INT
Result = myfunction(x)
PRINT STR$(Result)
CLOSECONSOLE


/* Include file */

DECLARE myfunction(in as INT),INT
DECLARE myfunction2(),INT
DECLARE INTRAND(min as INT,max as INT),INT


What's is wrong because my main program fiails and have no access to my dll functions, why
What is wrong here, I'm not so an experience in EBASIC

With kind regards
Stephane
Title: Re: I can't access to functions in my dll
Post by: Ionic Wind Support Team on October 29, 2008, 02:21:36 PM
Stephane,
It's a DLL, you have to use the IMPORT keyword.

Users Guide -> Language -> Using DLL's

Title: Re: I can't access to functions in my dll
Post by: Techno on October 29, 2008, 02:59:07 PM
Paul

Where can I place this import keyword in my include file?
Title: Re: I can't access to functions in my dll
Post by: Ionic Wind Support Team on October 29, 2008, 03:01:58 PM
Please Stephane, read the users guide, at least once.  I gave you the exact page you needed to look at.

DECLARE IMPORT,myfunction(in as INT),INT
DECLARE IMPORT,myfunction2(),INT
DECLARE IMPORT,INTRAND(min as INT,max as INT),INT

Paul.