Dukascopy Support Board
http://www.dukascopy.com/swiss/english/forex/jforex/forum/

Dll usage from strategies
http://www.dukascopy.com/swiss/english/forex/jforex/forum/viewtopic.php?f=65&t=46790
Page 1 of 1

Author:  ASLOG2002 [ Wed 08 Jan, 2014, 13:06 ]
Post subject:  Dll usage from strategies

Today there was support for loading DLL?
Publish, please working example. If such support is not available, please inform on the state of development.

Author:  API Support [ Wed 08 Jan, 2014, 14:51 ]
Post subject:  Re: lite DLL Support of jforex platform

You don't need any specific "platform support". Consider using jna, for instance:
@RequiresFullAccess
@Library("c:/temp/jna.jar")
public class StratMsgBoxJna implements IStrategy {

    public interface User32 extends com.sun.jna.Library {
        int MessageBoxA(int hwnd, String text, String caption, int flags);
        public int GetSystemMetrics(int nIndex);
    }

    @Override
    public void onStart(IContext context) throws JFException {
        User32 user32 = (User32) Native.loadLibrary("user32", User32.class);
        user32.MessageBoxA(0, "Hello JForex Strategy", "Test string from JForex Strategy", 1);
        context.getConsole().getOut().println("Screen resolution: " + user32.GetSystemMetrics(1) + " x " + user32.GetSystemMetrics(0));
    }


Attachments:
StratMsgBoxJna.java [1.17 KiB]
Downloaded 1086 times

Author:  ASLOG2002 [ Sat 11 Jan, 2014, 16:19 ]
Post subject:  Re: lite DLL Support of jforex platform

Thank you. Successfully loaded my DLL. Appropriate to make a few remarks.
1. You can load only 64-bit DLLs.
2. I was not able to determine the path where to place the file DLL.
3. I put my DLL file in the directory "C: \ windows \ system32".

Author:  API Support [ Tue 14 Jan, 2014, 08:30 ]
Post subject:  Re: lite DLL Support of jforex platform

ASLOG2002 wrote:
1. You can load only 64-bit DLLs.
Dll bits should match the one of your Java jre bits.
ASLOG2002 wrote:
2. I was not able to determine the path where to place the file DLL.
3. I put my DLL file in the directory "C: \ windows \ system32".
Did you try System.setProperty("jna.library.path", "c:\\temp\\myDlls");? See more after the line "Make your target library available to your Java program." in the Getting Started article.

Author:  ASLOG2002 [ Wed 15 Jan, 2014, 18:57 ]
Post subject:  Re: Dll usage from strategies

Thank you for your attention. I necessarily use a hint.

  Page 1 of 1