cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
sainiamaan
Level I

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

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
Eric_Hill
Staff

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

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.

View solution in original post

4 REPLIES 4
jmpbeginner
Level III

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

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

Eric_Hill
Staff

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

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
Level I

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

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

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

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