BookmarkSubscribe
Choose Language Hide Translation Bar
sainiamaan
Community Trekker

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;

0 Kudos
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.

0 Kudos
4 REPLIES 4
jmpbeginner
Community Trekker

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

0 Kudos
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.

0 Kudos
sainiamaan
Community Trekker

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.

0 Kudos
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