Login Page - Create Account

Support Board


Date/Time: Sun, 28 Apr 2024 07:59:25 +0000



Post From: help on some basics of calling external DLL

[2018-04-17 07:01:25]
Andy Sureway - Posts: 93
Thanks for your tip!

The Sierra Chart on my end is 64-bit version. Then I am wondering whether it was because I had wrong configuration for Visual Studio. I am very new to it. Just checked: the previous dll file was built for Win32. Should I change it to x64 or other configuration?

Also I am wondering whether the keyword --- extern "c" --- in the cpp file has any impact?

The following is the code for DLL_Tutorial.cpp. Thanks a lot!

#include <iostream>
#include "DLL_Tutorial.h"

#define DLL_EXPORT

extern "C"
{
DECLDIR int Add( int a, int b )
{
return( a + b );
}

DECLDIR void Function( void )
{
std::cout << "DLL Called!" << std::endl;
}
}