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".