Subscribe Bookmark RSS Feed

I need to call C# method from JMP script. Please guide

sainiamaan

Community Trekker

Joined:

Mar 22, 2014

I am looking forward to call c# method from JMP.I tried using LoadDll function. but it is not working. Please guide on this. below is code

dll = Load DLL("C:/Chap23/SampleJMPCall.dll");

dll << DeclareFunction(

  "WriteFile", 

  Alias( "Test" ), 

  Arg( UnicodeString, "str" ), 

  Returns( Int32 )

);

result = dll << Test("Here is a message from JMP.");

Show(result);

dll << UnLoadDLL;

1 ACCEPTED SOLUTION

Accepted Solutions
Solution

Unfortunately, the DLL calling interface in JMP does not support calling functions in managed code (assemblies).  It can only call native code functions exported by native code DLLs.

4 REPLIES
jmpbeginner

Community Trekker

Joined:

Sep 11, 2013

i'm having the same issue... can anyone help steer us in the right direction?

load DLL works fine (no error written to log), but i get an error when trying to declare.

the function name in the DLL i'm trying to declare call is "lookUp()":

dll_obj << DeclareFunction(

  "lookUp",

  Convention( STDCALL ),

  Alias("LU"),

  Arg(AnsiString, "NW"),

  Returns( Int32 ),

);

I get the following error:

Error initializing function "lookUp". The specified procedure could not be found.

in access or evaluation of 'DeclareFunction' , Bad Argument( "lookUp" ), DeclareFunction(

  "lookUp",

  Convention( STDCALL ),

  Alias( "LU" ),

  Arg( AnsiString, "NW" ),

  Returns( Int32 )

)

In the following script, error marked by /*###*/

dll_obj << DeclareFunction(

  "lookUp",

  Convention( STDCALL ),

  Alias( "LU" ),

  Arg( AnsiString, "NW" ),

  Returns( Int32 )

) /*###*/

any help is GREATLY appreciated!  thanks in advance

Solution

Unfortunately, the DLL calling interface in JMP does not support calling functions in managed code (assemblies).  It can only call native code functions exported by native code DLLs.

sainiamaan

Community Trekker

Joined:

Mar 22, 2014

I have also started getting the error same while declaring function.

In the following script, error marked by /*###*/

dll_obj << DeclareFunction(

  "WriteFile",

  Convention( STDCALL ),

  Alias( "Test" ),

  Arg( UnicodeString, "str" ),

  Returns( Int32 )

) /*###*/


any idea on this. Earlier i was getting the error --  Error initializing function "WriteFile". The specified procedure could not be found..


Please suggest.

Eric_Hill

Staff

Joined:

Oct 1, 2013

For problems like this, your best bet is to run "dumpbin -exports dll-name" on the DLL you are trying to call functions in and make sure that the function exists and is named what you think it is named (the name is not decorated, etc.). dumpbin.exe is part of Visual C++.  There may be other tools that can list a dll's exports, I don't know.

HTH,

Eric