dll wrapper

Previous topic - Next topic

djtoon

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?


MrTAToad

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

Kitty Hello

use the DECLARE functions in an INLINE block, that's the best method. The others are old and only for backwards compatibility.