Page 1 of 1

Visual Studio C++ DLL Template

Posted: Sun Aug 06, 2017 1:08 am
by imamushroom
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

Re: Visual Studio C++ DLL Template

Posted: Sun Sep 10, 2017 11:23 am
by badasstrader
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.

Re: Visual Studio C++ DLL Template

Posted: Thu Sep 21, 2017 1:43 am
by christoff
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

Re: Visual Studio C++ DLL Template

Posted: Tue Feb 13, 2018 9:21 pm
by beno
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-

Re: Visual Studio C++ DLL Template

Posted: Wed Jul 11, 2018 9:34 am
by jpygbp
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

Re: Visual Studio C++ DLL Template

Posted: Wed Feb 20, 2019 10:53 am
by KevinTester
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".

Re: Visual Studio C++ DLL Template

Posted: Wed Nov 27, 2019 8:34 am
by windsurfingstew
Does ForexTester4 have the same API, or have they not added API features?

Re: Visual Studio C++ DLL Template

Posted: Wed Nov 27, 2019 9:35 am
by windsurfingstew
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.

Re: Visual Studio C++ DLL Template

Posted: Thu Nov 28, 2019 6:20 am
by FX Helper
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.

Re: Visual Studio C++ DLL Template

Posted: Wed Apr 28, 2021 7:34 pm
by imamushroom
The link must have expired in the first post. Here it is again as an attachment.
DllTemple.zip
(4.33 KiB) Downloaded 147 times