c++ - Why does Pascal Script expect another semicolon near my external-function declaration? -


i have written function in c++, making dll:

functions.h:

#ifndef functions_h #define functions_h   int dllsquare(int x); #endif  /* functions_h */ 

functions.cpp:

#include "functions.h" int dllsquare(int x){     return x*x; } 

i compiled dll. import pascal script:

program testdll;  function square(x: integer): integer; external 'dllsquare@libtestdll.dll';  begin end.  

now doesn't compile. get:

(7:1): semicolon (';') expected @ line 6
compiling failed.

several tutorials on internet tell me way go, missing here?

pascal script throw "semicolon expected" error if declare external function , don't have handler assigned onexternalproc event.

you can implement yourself, or can use dllexternalproc upsc_dll unit. consider calling registerdll_compiletime on compiler component, assigns onexternalproc event , registers 2 functions scripts call, unloaddll , dllgetlasterror.

although it's understandable raise error when host program has provided no means of handling external functions, specific wording of error message nonsense. encourage file issue project improved.


Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -