//--- change string// NOT using MqlStruct... ??string text="A quick brown fox jumps over the cat";
bool b=fnReplaceString(text,"fox","DOG");
Print(b," Replace: ",text);
but do not clearly understand how to use struct MqlStr in this code? (though it works as is)
cli c++ is used in MS Visual Studio - writing c++ libs in NET... you'd better to get acquanted with a whole .NET-libs infrastructure to deal with it... but really, I also lack experience with Visual Studio -- therefore will not debate this topic...
just have written about calling-conventions' differences in past & my suppositions over now
Well, a Lib has no execution context. That's why it is called a lib.
When binding it to something like a cli executable, it gets a context in which it is used, but that could also be a gui application.
That's why it is a lib, or a dll.
.net has a different prerequisite of loading such a lib, there are different contextual loading environments, which require certain functions/configurations to be present in the lib.
A lib is a lib, independent of it's context it gets loaded to.
.net has a different prerequisite of loading such a lib, there are different contextual loading environments,
NOT exactly... you can use C#.NET libs in VB.NET-Projects & vc.vs. ... I assume & am almost sure, that such concept is accepted by Microsoft when creating all its NET-libs & even those that are not created yet (I mean any that a developer can create himself) - inter_compatibility is much more better in NET.infrastructure now, than it was earlier in before-NET-times
really helps! (compiled with MinGW release_link_options: -Wl,--kill-at)
dll.h
dll.cpp
#include <windows.h> #include <wchar.h> #include "myDllMQL.h" BOOL APIENTRY DllMain(HANDLE hModule, DWORD reason, LPVOID lpReserved) { switch (reason) { case DLL_PROCESS_ATTACH: break; case DLL_PROCESS_DETACH: break; case DLL_THREAD_ATTACH: break; case DLL_THREAD_DETACH: break; } return TRUE; } DLLIMPORT bool __stdcall fnReplaceString(wchar_t *text, wchar_t *from, wchar_t *to) { wchar_t *cp; //--- check params if(text==NULL || from==NULL || to==NULL) return false; if(wcslen(from)!=wcslen(to)) return false; //--- find substr if((cp=wcsstr(text,from))==NULL) return false; //--- change memcpy(cp,to,wcslen(to)*sizeof(wchar_t)); return true; }mql4 - import from Library folder
use
but do not clearly understand how to use struct MqlStr in this code? (though it works as is)cli c++ is used in MS Visual Studio - writing c++ libs in NET... you'd better to get acquanted with a whole .NET-libs infrastructure to deal with it... but really, I also lack experience with Visual Studio -- therefore will not debate this topic...
just have written about calling-conventions' differences in past & my suppositions over now
NOT exactly... you can use C#.NET libs in VB.NET-Projects & vc.vs. ... I assume & am almost sure, that such concept is accepted by Microsoft when creating all its NET-libs & even those that are not created yet (I mean any that a developer can create himself) - inter_compatibility is much more better in NET.infrastructure now, than it was earlier in before-NET-times