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!
32bit 14.3JMP
OK
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.
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.
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:
Thanks Experts!grok3:Simple BackgroundThe user wants to receive real-time L1 five-level order book snapshot data (updated every 3 seconds) from the "Tornado" interface (StockDrv.dll), which only supports 32-bit applications. Originally, this was achieved in 32-bit JMP 14.3 using a custom Bridge.dll and JSL script. Now, the goal is to replicate this in 64-bit JMP, which cannot directly load 32-bit DLLs.
Core SolutionUse a 32-bit agent (agent32.exe) to load Bridge.dll, fetch data from StockDrv.dll, and send it via TCP socket to 64-bit JMP, which receives and parses it into a table.
Implementation32-bit Agent (agent32.exe):Loads Bridge.dll, calls Bridge_Init(0x9001), and sends 158-byte RCV_REPORT_STRUCTExV3 data via TCP (port 5000).Compile:batch
cd /d I:\DZH\Agent"I:\mingw32\bin\i686-w64-mingw32-g++.exe" -std=c++20 -O2 -Wall -I. -DWIN32 -static-libgcc -static-libstdc++ agent32.cpp -o agent32.exe -luser32 -lkernel32 -lws2_3264-bit JMP JSL:Connects to socket, reads 158-byte data, parses fields (e.g., stock code, price, five-level bids/asks), and writes to table.
Key JSL snippet:sock = Open("|tcp:127.0.0.1:5000");dt = New Table("L1_Snapshot", New Column("Code", Character), New Column("Epoch", Numeric), New Column("NewPrice", Numeric), /* Add B1-5_P/V, S1-5_P/V */);blob = Blob();While(1, bytes = sock << Read(blob, 158); If(bytes == 158, /* Parse and write to dt */));
NotesEnsure agent32.exe accesses Bridge.dll and StockDrv.dll.Use set PROCESSOR_ARCHITECTURE=x86 for 32-bit execution.Handle data duplication by updating table rows based on stock code.
Ultimately, it was through asking OpenAI o3
A relay DLL was recompiled in C++ to specifically provide data for JMP.But only a 32-bit JMP can be used
The problem is that the data reading in the JMP table cannot display Chinese correctly.
The AI has modified CPP multiple times but failed. Even when different character sets were used in the Settings of JMP, it still didn't work and remained garbled.
Names Default To Here(1); dll = Load DLL("I:\\DZH\\Bridge\\Bridge.dll"); dll << Declare Function("Bridge_Init@4", Convention(STDCALL), Alias("Bridge_Init"), Arg(UInt32), Returns(Int32)); dll << Declare Function("Bridge_Quit@0", Convention(STDCALL), Alias("Bridge_Quit"), Returns(Void)); dll << Declare Function("Bridge_GetCount@0", Convention(STDCALL), Alias("Bridge_GetCount"), Returns(Int32)); dll << Declare Function("Bridge_ReadTSV@4", Convention(STDCALL), Alias("Bridge_ReadTSV"), Arg(Int32), Returns(AnsiString)); If(dll << Bridge_Init(36865) != 1, Throw("Bridge_Init失败")); dt = New Table("L1_Snapshot", New Column("Name", Character, "Nominal"), New Column("Epoch", Numeric, "Continuous"), New Column("NewPrice", Numeric), New Column("B1_P", Numeric), New Column("B1_V", Numeric), New Column("S1_P", Numeric), New Column("S1_V", Numeric), New Column("B2_P", Numeric), New Column("B2_V", Numeric), New Column("S2_P", Numeric), New Column("S2_V", Numeric), New Column("B3_P", Numeric), New Column("B3_V", Numeric), New Column("S3_P", Numeric), New Column("S3_V", Numeric), New Column("B4_P", Numeric), New Column("B4_V", Numeric), New Column("S4_P", Numeric), New Column("S4_V", Numeric), New Column("B5_P", Numeric), New Column("B5_V", Numeric), New Column("S5_P", Numeric), New Column("S5_V", Numeric) ); While(1, cnt = dll << Bridge_GetCount(); For(i=0, i<cnt, i++, line = dll << Bridge_ReadTSV(i); If(Is Missing(line)==0 & Contains(line, "\t"), vals = Words(line, "\t"); If(N Items(vals)==23, dt << Add Rows(1); r = N Rows(dt); Column(dt,1)[r] = vals[1]; Column(dt,2)[r] = Num(vals[2]); Column(dt,3)[r] = Num(vals[3]); idx=4; For(c=4, c<=23, c++, Column(dt,c)[r] = Num(vals[idx]); idx++; ); ); ); ); Wait(0.1); );
Thanks Experts!Another AI made this suggestion; here is the original wording: “I get it now—this isn’t a ‘GBK → UTF-8’ problem at all. It’s a memory-misinterpretation issue that scrambles both numbers and Chinese text. Those weird glyphs (e.g., ↗?C, 镃毂镃叓) look like JMP grabbed a wrong pointer from the DLL and decoded the raw binary of a floating-point field as if it were GBK text. My suspicion: 1. Structure layout mismatch Your `RCV_REPORT_STRUCTExV3` in Bridge.cpp doesn’t match the byte alignment (`packing`) used inside StockDrv.dll. If the `#pragma pack` settings differ, the data shifts and the Chinese you read is actually garbage from a float. 2. Stock code is not a plain char[8] In some versions of DZH the code field is `char m_szLabel[16]` or even wide-char (2-byte GB2312). If you `memcpy` it as single-byte, you get half-cut Han characters. 3. DLL interface version mismatch If StockDrv.dll is returning a V4 structure while you’re reading it as V3, everything will be off. Here’s what I suggest: - Force the same `#pragma pack(push, 1)` that StockDrv.h uses. - Verify the actual length of `m_szLabel` (`STKLABEL_LEN`). - Skip any UTF-8 conversion; dump the raw bytes straight to CSV. - Make sure floats and ints land in their correct offsets—no shifting. I’ll write you a complete, alignment-correct version with key points commented; just drop it in.”