#import with build 2170 ... what happened?

To add comments, please log in or register
Doerk Hilger
1272
Doerk Hilger  
#import "anydll.dll"

        int test(int x);
#import

anydll::test(1);

... is not working anymore and produces error "'anydll' is not a class, struct or union"

I cannot find nothing within the documentation about it. 

Thx for helping
Doerk Hilger
1272
Doerk Hilger  
namespace anydll
        {
        #import "anydll.dll"
        int test(int x);
        #import
        }

anydll::test(1);

it says: "#import" ... name expected

Really? When you click on "namespace" in the documentation about the new release, the link is a dead-end link. https://www.metatrader5.com/en/docs/basis/namespace

Alain Verleyen
38071
Alain Verleyen  
Doerk Hilger:

... is not working anymore and produces error "'anydll' is not a class, struct or union"

I cannot find nothing within the documentation about it. 

Thx for helping
This code compiles perfectly. Must be something else in your real code.
Alain Verleyen
38071
Alain Verleyen  
Doerk Hilger:

it says: "#import" ... name expected

Really? When you click on "namespace" in the documentation about the new release, the link is a dead-end link. https://www.metatrader5.com/en/docs/basis/namespace

https://www.mql5.com/en/docs/basis/namespace
Documentation on MQL5: Language Basics / Namespaces
Documentation on MQL5: Language Basics / Namespaces
  • www.mql5.com
Applying 'namespace' allows splitting the global namespace into subspaces. All IDs within the namespace are available to each other without a specification. The :: operator (context resolution operation) is used to access namespace members from the outside. //| Script program start function                                    | Namespaces...
Doerk Hilger
1272
Doerk Hilger  
Nope, it compiles not. When I got back to the build before, the same code compiles without any errors. 
Alain Verleyen
38071
Alain Verleyen  
Doerk Hilger:
Nope, it compiles not. When I got back to the build before, the same code compiles without any errors. 

It compiles !

#import "anydll.dll"
int test(int x);
#import

//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
//---
   anydll::test(1);

  }
Doerk Hilger
1272
Doerk Hilger  
I talk about the original program code, it does not compile with the new build while the old build compiles without errors. And there is nothing else, same method with DLLs. I rolled back to the old build, but will create a more complex sample using the new build as soon as possible. 
Doerk Hilger
1272
Doerk Hilger  

After moving all code which imports Windows DLL functions into one file, the error message was gone - without changing any part of the code itself. 

So this seems to be a kind of a preprocessor bug. 

What I suspected was, that multiple imports of the the same DLL would cause this error, but after moving them to one file, I figured out that there were no multiple imports before, so I have no clue how I could provoke this error. 

To add comments, please log in or register