futures io

DefineDLLFunc C++ Example

Discussion in EasyLanguage Programming

    1. trending_up 374 views
    2. thumb_up 0 thanks given
    3. group 2 followers
    1. forum 1 posts
    2. attach_file 0 attachments

Welcome to futures io: the largest futures trading community on the planet, with well over 150,000 members
  • Genuine reviews from real traders, not fake reviews from stealth vendors
  • Quality education from leading professional traders
  • We are a friendly, helpful, and positive community
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts
  • We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

(If you already have an account, login at the top of the page)

Search this Thread

DefineDLLFunc C++ Example

(login for full post details)
  #1 (permalink)
Posts: 1 since May 2020
Thanks: 0 given, 0 received

Hi, I'm trying to create a HelloWorld example c++ project but am getting this error from TS when calling it: "Invalid number of parameters were passed to a user dll function".
I'm not a c++ programmer but a C# programmer creating a wrapper for C# COM.

Here's the code:

The c++ code:
// COMTESTINGINTEROP.h - Contains declarations of functions
#pragma once

#define COMTESTINGINTEROP_API __declspec(dllexport)
#define COMTESTINGINTEROP_API __declspec(dllimport)

#include "pch.h"
#include "COMTestingInterop.h"

LPSTR hello(char* world)
return LPSTR(world);

DefineDLLFunc: "COMTestingInterop.dll",LPSTR,"hello",LPSTR; {World} ;

World( "Hey from TS" ) ;

once clearprintlog;

If I remove the arguments, and return from the cpp function:
return LPSTR("hello from cpp");
It gets passed back to TS and prints to the log fine. The issue seems to be isolated to being able to add and pass arguments.

Reply With Quote

Can you help answer these questions
from other members on futures io?
What is Your Experience with TradeStations API?
2+ instances of Ninjatrader
New subforum for Generative AI and LLM
Elite Generative AI / LLM Trading
Trading Reviews and Vendors
Freelancer to build an Apps to Control TradeStation (TS) …
Best Threads (Most Thanked)
in the last 7 days on futures io
Big Mike in Ecuador
42 thanks
top trading courses
13 thanks
Trader Sentiment Tool for our community
11 thanks
futures io site changelog and issues/problem reporting
11 thanks
Hedge your losers to turn them into winners
10 thanks

(login for full post details)
  #2 (permalink)
RDU, North Carolina
Posts: 1 since Mar 2023
Thanks: 0 given, 0 received

Hello TheMetalDog,

First, let me say I am making a suggestion without trying. Sorry, but I'm on the road and don't have access to a computer with a compiler.

The signature of your function does not exactly match. LPSTR is Microsoft's "long pointer to a unicode string" if I remember correctly. The "char *" is a pointer to a character. Not identical in the C/C++ domain.

LPSTR hello(LPSTR world)
return LPSTR(world);

Try that and let me know if it works. Good luck!

Reply With Quote

futures io Trading Community Platforms and Indicators EasyLanguage Programming > DefineDLLFunc C++ Example

Last Updated on April 9, 2023

Copyright © 2023 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada), info@futures.io
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts