cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Register to attend Discovery Summit 2025 Online: Early Users Edition, Sept. 24-25.
  • New JMP features coming to desktops everywhere this September. Sign up to learn more at jmp.com/launch.
Choose Language Hide Translation Bar
lala
Level IX

How can LoadDLL a 32-bit DLL through JSL?

My operating system is 64-bit Windows 10.One software, HailiLive.EXE, is still 32-bit.There is Drv.dll;
How can I use JSL of 64-bit JMP software to call the 32 bit Drv.dll of this software HailiLive.EXE?

 

 

Thanks Experts!

1 ACCEPTED SOLUTION

Accepted Solutions
lala
Level IX

Re: How can LoadDLL a 32-bit DLL through JSL?

5 REPLIES 5
lala
Level IX

Re: How can LoadDLL a 32-bit DLL through JSL?

A message is displayed:

 

Access or Assign,LoadDLL = /*###*/Load DLL("I:\HailiLive\Drv.dll") /*###*/ evaluation "cannot load external dll" I:\HailiLive\Drv.dll".%1 is not a valid Win32 application.

jthi
Super User

Re: How can LoadDLL a 32-bit DLL through JSL?

Scripting Guide > Extending JMP > Dynamic Link Libraries (DLLs) 

 

Note: 64-bit JMP cannot load 32-bit DLLs. You must recompile a 32-bit DLL for JMP to be able to load it.

-Jarmo
lala
Level IX

Re: How can LoadDLL a 32-bit DLL through JSL?

OK

Note: 64-bit JMP cannot load 32-bit DLLs. You must recompile a 32-bit DLL for JMP to be able to load it.

lala
Level IX

Re: How can LoadDLL a 32-bit DLL through JSL?

32bit 14.3JMP

OK2025-07-11_15-46-29.png

Re: How can LoadDLL a 32-bit DLL through JSL?

There is a COM solution to the issue of loading a 32-bit DLL into a 64-bit application.  JMP's JSL supports COM Automation on Windows.  However, this would be a lot of work to wrapper the DLL using COM.

 

My Google Search:

using COM to marshal a 32-bit dll for a 64-bit application

 

AI response:

To call a 32-bit DLL from a 64-bit application, you need to use COM (Component Object Model) in an out-of-process server setup. This involves creating a separate 32-bit COM server application that acts as a wrapper for the 32-bit DLL. The 64-bit application can then communicate with this server through COM's inter-process communication mechanisms. 
 
Here's a breakdown of the process:
1. Create a 32-bit COM Server Application:
  • New ATL Project:
    Create a new ATL (Active Template Library) project in Visual Studio, specifically configured as an executable (not a DLL).
  • Add ATL Simple Object:
    Add a new ATL Simple Object to the project. This will be the core of your COM server.
  • Implement Interfaces:
    Define the interfaces (using .idl files) that the 64-bit application will use to interact with the 32-bit DLL.
  • Forward Calls:
    Within the COM object's methods, forward the calls to the corresponding functions in the 32-bit DLL. This may involve marshalling data between the two processes. 
     
2. Register the COM Server:
  • You'll need to register the COM server using DllSurrogate. This allows the 64-bit process to instantiate the 32-bit COM object out-of-process.
  • Registry Entries:
    Ensure the necessary registry entries are created to allow the 32-bit in-process server to be loaded by the system's DllSurrogate. 
     
3. Consume the COM Server in the 64-bit Application:
  • Create a COM Client:
    .
    In your 64-bit application, create a COM client that connects to the 32-bit COM server. You will use the COM interfaces defined in the .idl file. 
     
  • Inter-process Communication:
    .
    COM handles the inter-process communication, marshalling data between the 64-bit and 32-bit processes. 
     
Key Considerations:
  • Interface Definitions:
    Ensure the interfaces defined in the 64-bit application's COM client and the 32-bit server are compatible, including data types and method signatures. Consider using IDL (Interface Definition Language) to define the interfaces. 
     
  • Marshalling:
    COM handles the marshalling of data between the two processes. If you have complex data structures, you may need to explicitly marshal them using the Marshal class or MarshalAsAttribute, according to Learn Microsoft. 
     
  • Performance:
    While COM provides inter-process communication, it introduces overhead. For performance-critical applications, consider the impact of this overhead. 
     
  • Alternatives:
    If recompiling the 32-bit DLL is an option, that is generally the preferred approach, according to Stack Overflow. 
     
By using this approach, you can successfully integrate a 32-bit DLL into your 64-bit application, leveraging the power of COM for inter-process communication and data marshalling. 

Recommended Articles