I built an external library AlgLib for some math computation. This library has no any other dependencies.
In my strategy builder, I add this library (AlgLib.DLL) as references. I can compile my strategy successfully, but got run-time error:
QUOTE:
Runtime error: Could not load file or assembly 'AlgLib, version=1.0.3932.39070,Culture=neutral, PublicKeyToken=null' or one of its dependencies.
I cannot think of any problems. One possibility I guess is the .NET platform inconsistent. As I remembered, Wealth-lab can be run with .NET 2.0 or 3.5. Actually I have both platforms, and I am not sure how to configure the target platform of Wealth-lab.
Later, I tried to compile my AlgLib in both .NET 3.5 and 2.0, I got the same run time error in Wealth-Lab. However, if I use the AlgLib.DLL in SharpDevelop environment, it has no this run-time error.
Did I miss anything?
Size:
Color:
.NET 3.5 is OK for use with WL6. As mentioned in the Wiki FAQ, only 4.0 is not OK. A couple of ideas:
1. Place AlgLib.DLL into the WLP's main folder. Then don't add a Reference (Wealth-Lab will find it.)
2. Some assembly on which AlgLib.DLL depends (if there's one), might be missing. Make sure it was copied to the main folder as well.
Size:
Color:
Size:
Color:
Note that it's a better idea to post such questions under "General" or "Extensions", rather than here - "Trading Strategies". This place is for discussing actual strategies with real code rather than some technical issues with a 3rd party library that may have a connection to a Strategy (or may not).
Size:
Color:
Thanks. Eugene and Cone.
QUOTE:
1. Place AlgLib.DLL into the WLP's main folder. Then don't add a Reference (Wealth-Lab will find it.)
That solves the problem. It is a little bit tricky that other directories wont work.
Size:
Color:
QUOTE:
It is a little bit tricky that other directories wont work.
...with this library. I remember a case like this a couple years from now, just couldn't find the thread.
Size:
Color:
Hello Cone
I downloaded the .dll file in your post above #3
I assume that all I need in WL is to say
CODE:
Please log in to see this code.
I've put the dll file where all the other dll's for WL are kept (e.g. TASCIndicators, etc...)
When I compile I get an error that the type or namespace could not be found.
Is this perhaps because your post was from Oct-2010 and it is "old" and needs to be recompiled?
Any thoughts appreciated
Size:
Color:
There's no such namespace. This will work:
CODE:
Please log in to see this code.
To peek inside an assembly for this purpose you might want to use Visual Studio's Object Browser or similar tool.
Size:
Color:
Indeed it does. The .dll file contained caps so I made an assumption
Thanks again
Size:
Color:
Hello Eugene & Cone,
I downloaded the ALGLIB from Cone's post above and place the file in the WLP6 main directory (C:\Program Files\Fidelity Investments\Wealth-Lab Pro 6) and included the statement "using alglib;" in my strategy and still couldn't get it compiled. When I compile it has an error "The type or namespace name 'alglib' could not be found". This is strange and should work from the posts above - did I do something wrong? Thank you.
Size:
Color:
Size:
Color:
Eugene, thanks for the quick reply. I closed WLP, removed the blocking due to "File downloaded from the internet" flag (and made sure I have the right permission to do that), open WLP and still got the same compile error. Other suggestions? Thanks.
Size:
Color:
See my post #8 with the correct syntax, not #7 with the wrong one you're trying to use.
Size:
Color:
Eugene,
That works! Now I downloaded and replaced the old dll with a more recent version - alglibnet2.dll. Using the same directive statement - "using alglib", I got a compiled error: "A using namespace directive can only be applied to namespaces; 'alglib' is a type not a namespace". My guess is that they must change 'alglib' to a type within the new dll and the new namespace have been changed to something else. If this is the case, based on your post #8, I should use a 'Visual Studio's Object Browser or similar tool' to look inside the dll file to learn its new namespace. Is this guess correct? Thank you.
Size:
Color:
Usually, sites of developers have an online usage guide section where you can browse for a usage sample and/or calling convention.
Size:
Color:
They changed it to a class type. thanks to your post #8, I was able to see the correct names and dependencies. Thanks again.
Size:
Color:
Eugene,
I am re-posting this question here - am still could not understand and resolve it. I got a compiled error in Visual Studio when using a DllImport() like the one shown below.
Error: The name 'alglib' does not exist in the current context
Declaration:
CODE:
Please log in to see this code.
Function call:
CODE:
Please log in to see this code.
The same code syntax is work fine when compiled within WLP. Thanks for any suggestions you can give.
Size:
Color:
Size:
Color:
Thanks Eugene. In VS adding reference is done via the GUI (Project --> Add Reference) rather than using the DllImport seems to work better - at least for me.
Size:
Color:
I don't think that DllImport, which is used for calling unmanaged code, is a substitute for directly referencing a .NET assembly which alglib is.
Size:
Color:
I downloaded the ALGLIB.dll file (12/16/09 552KB) in WLP's main folder (C:/programfiles/MS123/Wealth-Lab Developer 6).
I am trying to call some functions in a strategy containing alglib, e.g.
corr = alglib.pearsoncorr2(x, y, i);
The alglib statement is underlined in red and states:
The name alglib does not exist in the current context.
When I compile I get compile errors for each call on alglib to the effect, for example:
The type or name space pearsoncorr2 does not exist in the name space alglib (are you missing an assembly reference?)
I checked my for the version of .Net Framework installation and version 4.7 or newer is installed.
Please help as I need to do matrix and statistical operations in my strategy.
I migrated from Fidelity and WLD on 7/25/20 just in case that makes a difference.
Thanks,
Rich Man
Size:
Color:
Please review this topic for insights. Let us know if issue persists. Thanks.
Size:
Color: