GLBasic forum

Main forum => GLBasic - en => Topic started by: djtoon on 2010-Sep-07

Title: dll wrapper
Post by: djtoon on 2010-Sep-07
hi im warpping this dll and i get alot of errors

code:


INLINE
  extern "C" {
    DECLARE_ALIAS(exportBeginScene, "ebrowser.dll", cv_eb_create, () ,void);

  }
ENDINLINE

the error i get:

C:\glbasic\gpc_temp0.cpp: In function `int __GLBASIC__::__MainGameSub_()':
C:\\glbasic\gpc_temp0.cpp:25: error: expected unqualified-id before string constant


anyone can help?

Title: Re: dll wrapper
Post by: MrTAToad on 2010-Sep-07
In C, you dont use DELCARE_ALIAS - that is only used in GLBasic - in C, you would use the standard extern function.  So, you can either do :

Code (glbasic) Select
DECLARE_ALIAS(exportBeginScene, "ebrowser.dll", cv_eb_create, () ,void);

or

Code (glbasic) Select
INLINE
  extern "C" void exportBeginScene(void);
ENDINLINE


or

Code (glbasic) Select
DLLCALL("ebrowser.dll", "exportBeginScene", void);

Which you use would depend on whether you have the source code or not and whether you know the function names and parameters
Title: Re: dll wrapper
Post by: Kitty Hello on 2010-Sep-14
use the DECLARE functions in an INLINE block, that's the best method. The others are old and only for backwards compatibility.