Visual Studio C++ DLL Template
-
- Posts: 33
- Joined: Wed Jan 20, 2016 2:52 pm
Visual Studio C++ DLL Template
Here's a blank C++ DLL template that Forex Tester Support sent me after having difficulties setting the correct settings in Visual Studio 2017 Community. The file is too large to upload to the forum so have place it here: http://www.filedropper.com/forextesterdll
-
- Posts: 6
- Joined: Tue Aug 22, 2017 10:51 am
Re: Visual Studio C++ DLL Template
Hello,
I think I'm going crazy trying to compile the lesson 1 DLL with Visual Studio 2017 Community. Linking is hell !
I'd like to use your template but I don't know how to get it, the link send me to the home page of filedropper.
I think I'm going crazy trying to compile the lesson 1 DLL with Visual Studio 2017 Community. Linking is hell !
I'd like to use your template but I don't know how to get it, the link send me to the home page of filedropper.
-
- Posts: 46
- Joined: Thu Nov 09, 2006 2:29 am
Re: Visual Studio C++ DLL Template
badasstrader wrote:Hello,
I think I'm going crazy trying to compile the lesson 1 DLL with Visual Studio 2017 Community. Linking is hell !
I'd like to use your template but I don't know how to get it, the link send me to the home page of filedropper.
Yeah same problem when I tried. Send me to home page as well
-
- Posts: 4
- Joined: Tue Feb 13, 2018 7:46 pm
Re: Visual Studio C++ DLL Template
To get lesson 1 working in an Empty Project on Visual Studio 2017, i had to do 2 things:
Edit Project Properties / Configuration Properties / C/C++ / Preprocessor / Preprocessor Definitions - Add _CRT_SECURE_NO_WARNINGS
Edit Project Properties / Configuration Properties / C/C++ / Command Line / Additional Options - Add /Zc:strictStrings-
Edit Project Properties / Configuration Properties / C/C++ / Preprocessor / Preprocessor Definitions - Add _CRT_SECURE_NO_WARNINGS
Edit Project Properties / Configuration Properties / C/C++ / Command Line / Additional Options - Add /Zc:strictStrings-
-
- Posts: 1
- Joined: Sat Jun 03, 2017 2:47 pm
Re: Visual Studio C++ DLL Template
Here is my batch file if you have any suggestions. I will upload a new version shortly to fix a few includes that are needed.
REM ////////////////////////////////////
REM batch file for Visual Studio Builds
REM ////////////////////////////////////
REM
@echo off
set CommonCompilerFlags=-Zi /Wv:18
set CommonLinkerFlags= /LD
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" x64
@echo on
mkdir "%~dp0build"
pushd "%~dp0build"
cl %CommonCompilerFlags% ../*.cpp %CommonLinkerFlags%
popd
REM ////////////////////////////////////
REM batch file for Visual Studio Builds
REM ////////////////////////////////////
REM
@echo off
set CommonCompilerFlags=-Zi /Wv:18
set CommonLinkerFlags= /LD
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" x64
@echo on
mkdir "%~dp0build"
pushd "%~dp0build"
cl %CommonCompilerFlags% ../*.cpp %CommonLinkerFlags%
popd
-
- Posts: 3
- Joined: Fri Feb 01, 2019 7:57 am
Re: Visual Studio C++ DLL Template
Couple of other things that you will need to do if you're not familiar with VS2017.
When you create a new project in VS it by default adds, #include "stdafx.h". The file "stdafx.h" includes inside itself "windows.h". Don't try to change that, way too many things are dependent the other stuff in "stdafx.h.
The following steps should get you to be able to build the .dll, assuming that your code has no errors in it.
1. Project Properies: C/C++ -> Preprocessor -> Preprocessor Definitions add _CRT_SECURE_NO_WARNINGS
2. Project Properies: C/C++ -> Command Line -> add /Zc:strictStrings-
3. Project Properies: Linker -> Input -> Module Definition File add correct Something.def
4. In dllmain.cpp comment out everything except #include "stdafx.h"
Most of the linker errors are due to the fact that dllmain.cpp provides a default entry point for the .dll. How ever, the ForexTester supplied file StrategyInterfaceUnit.h already defines the needed entry point. That's why you comment out all of the stuff in dllmain.cpp except the #include "stdafx.h".
When you create a new project in VS it by default adds, #include "stdafx.h". The file "stdafx.h" includes inside itself "windows.h". Don't try to change that, way too many things are dependent the other stuff in "stdafx.h.
The following steps should get you to be able to build the .dll, assuming that your code has no errors in it.
1. Project Properies: C/C++ -> Preprocessor -> Preprocessor Definitions add _CRT_SECURE_NO_WARNINGS
2. Project Properies: C/C++ -> Command Line -> add /Zc:strictStrings-
3. Project Properies: Linker -> Input -> Module Definition File add correct Something.def
4. In dllmain.cpp comment out everything except #include "stdafx.h"
Most of the linker errors are due to the fact that dllmain.cpp provides a default entry point for the .dll. How ever, the ForexTester supplied file StrategyInterfaceUnit.h already defines the needed entry point. That's why you comment out all of the stuff in dllmain.cpp except the #include "stdafx.h".
-
- Posts: 6
- Joined: Fri Jun 23, 2017 6:55 am
Re: Visual Studio C++ DLL Template
Does ForexTester4 have the same API, or have they not added API features?
-
- Posts: 6
- Joined: Fri Jun 23, 2017 6:55 am
Re: Visual Studio C++ DLL Template
I tried this. One further thing I had to do is:
5. Project Properties: C/C++ -> Precompiled Headers -> Precompiled Headers -> Not Using Precompiled Headers
If I don't do this I get messages that it can't find them. I'm not entirely sure why this works, and perhaps there is a better solution, but it gets me over the line.
5. Project Properties: C/C++ -> Precompiled Headers -> Precompiled Headers -> Not Using Precompiled Headers
If I don't do this I get messages that it can't find them. I'm not entirely sure why this works, and perhaps there is a better solution, but it gets me over the line.
-
- Posts: 1479
- Joined: Mon Apr 01, 2013 3:55 am
Re: Visual Studio C++ DLL Template
windsurfingstew wrote:Does ForexTester4 have the same API, or have they not added API features?
Yes, FT4 version has the same API files, they can be found in C:\ForexTester4\Examples folder by default.
-
- Posts: 33
- Joined: Wed Jan 20, 2016 2:52 pm
Re: Visual Studio C++ DLL Template
The link must have expired in the first post. Here it is again as an attachment.
Who is online
Users browsing this forum: No registered users and 15 guests