1

I have a DLL but no source code for it. I would like to call a method inside this DLL. DLL that is ActiveX

Now in this Picture. You can see that I want to access is the Test2.DLL which have fb1_CheckSensor Method. But it resides inside the Test1.DLL

So lets say I only have one option and that is to Load 1 DLL. Only Test1.DLL for JAVA

    import com.sun.jna.Library;
import com.sun.jna.Native;
import com.sun.jna.NativeLong;
import com.sun.jna.ptr.IntByReference;
import com.sun.jna.ptr.PointerByReference;

public interface FB4API3Lib extends Library{

FB4API3Lib INSTANCE = (FB4API3Lib)Native.loadLibrary("Interop.FB4API3Lib.dll", FB4API3Lib.class);


int fb1_Open(int nUnit);
void fb1_Close(int nUnit);
void fb1_SetCommunicationMode(int nMode);
int fb1_GetNumberOfUnits();
NativeLong fb1_Stop(int nUnit);
int fb1_Reset(int nUnit);
int fb1_CheckSensor(int nUnit,StringByReference strWrk);
int fb1_SetImageFileFolder(int nUnit,String strPath);
int fb1_SetImageFileName(int nUnit,String strFileName);
int fb1_SetImageRegulation(int nUnit,tagImageInfo pImageInto);
NativeLong fb1_SetEndorseData(int nUnit,String strEds);
NativeLong fb1_SetEndorseMultiLine (int nUnitNo, tagEdsMulti  pInfo);
int fb1_Run(int nUnit, IntByReference strWrk3, StringByReference strWrk, IntByReference strWrk2);
int fb1_Run1(int nUnit,StringByReference strWrk,IntByReference strWrk2);
int fb1_Run1Ex(int nUnit,StringByReference strWrk,IntByReference strWrk2);
int fb1_Eject(int nUnit,int nPocket,int nNext);
int fb1_WaitEjecting(int nUnit);
int fb1_WaitCompleted(int nUnit);
void fb1_GetDetailErrorInfo(String strErr);
int fb1_Initialize(int nUnit);
int fb1_SetBinaryMode(int nUnit, int nSide, int nMode);
int fb1_SetRunMode(int nUnit, int nMOde, int nOpt, int nPkt);
int fb1_GetImageData(int nUnit, PointerByReference hBmap);
int fb1_GetEndorseStatus(int nUnit, IntByReference pType, int nFunc, tagMtrIjpSts pStutus);
int fb1_SetDeviceInfo(int nUnit, int nDeviceInfoID, String pszIn);
int fb1_SetBinaryInfo(int nUnit, int nSide, tagFb1BiInfo pBiInfo);

}

Now for the Class that implements the above Interface

   import com.sun.jna.NativeLong;
import com.sun.jna.ptr.IntByReference;
import com.sun.jna.ptr.PointerByReference;


public class CallDLL implements FB4API3Lib {

    public int fb1_Open(int nUnit) {
    return INSTANCE.fb1_Open(nUnit);
}

public Object CreateTheClass() {
    return INSTANCE;
}

public void fb1_Close(int nUnit) {
    INSTANCE.fb1_Close(nUnit);
}
public void fb1_SetCommunicationMode(int nMode) {
    INSTANCE.fb1_SetCommunicationMode(nMode);
}

public int fb1_GetNumberOfUnits() {
    return INSTANCE.fb1_GetNumberOfUnits();
}

public NativeLong fb1_Stop(int nUnit) {
    return INSTANCE.fb1_Stop(nUnit);
}

public int fb1_Reset(int nUnit) {
    return INSTANCE.fb1_Reset(nUnit);
}

public int fb1_CheckSensor(int nUnit,StringByReference strWrk) {
    return INSTANCE.fb1_CheckSensor(nUnit,strWrk);
}

public int fb1_SetImageFileFolder(int nUnit,String strPath) {
    return INSTANCE.fb1_SetImageFileFolder(nUnit,strPath);
}

public int fb1_SetImageFileName(int nUnit,String strFileName) {
    return INSTANCE.fb1_SetImageFileName(nUnit,strFileName);
}

public int fb1_SetImageRegulation(int nUnit,tagImageInfo pImageInto) {
    return INSTANCE.fb1_SetImageRegulation(nUnit,pImageInto);
}

public NativeLong fb1_SetEndorseMultiLine(int nUnit,tagEdsMulti pInfo) {
    return INSTANCE.fb1_SetEndorseMultiLine(nUnit,pInfo);
}

public NativeLong fb1_SetEndorseData(int nUnit,String strEds) {
    return INSTANCE.fb1_SetEndorseData(nUnit,strEds);
}

public int fb1_Run(int uUnit, IntByReference strWrk3, StringByReference strWrk, IntByReference len) {
    return INSTANCE.fb1_Run(uUnit, strWrk3, strWrk, len);
}
public int fb1_Run1(int nUnit,StringByReference strWrk,IntByReference len) {
    return INSTANCE.fb1_Run1(nUnit,strWrk, len);
}

public int fb1_Run1Ex(int nUnit,StringByReference strWrk,IntByReference len) {
    return INSTANCE.fb1_Run1Ex(nUnit,strWrk, len);
}

public int fb1_Eject(int nUnit,int nPocket, int nNext) {
    return INSTANCE.fb1_Eject(nUnit,nPocket, nNext);
}

public int fb1_WaitEjecting(int nUnit) {
    return INSTANCE.fb1_WaitEjecting(nUnit);
}

public int fb1_WaitCompleted(int nUnit) {
    return INSTANCE.fb1_WaitCompleted(nUnit);
}

public void fb1_GetDetailErrorInfo(String strWrk) {
    INSTANCE.fb1_GetDetailErrorInfo(strWrk);
}

public int fb1_Initialize(int nUnit){
    return INSTANCE.fb1_Initialize(nUnit);
}

public int fb1_SetBinaryMode(int nUnit, int nSide, int nMode){
    return INSTANCE.fb1_SetBinaryMode(nUnit, nSide, nMode);
}

public int fb1_SetRunMode(int nUnit, int nMode, int nOpt, int nPkt){
    return INSTANCE.fb1_SetRunMode(nUnit, nMode, nOpt, nPkt);
}

public int fb1_GetImageData(int nUnit, PointerByReference pBmap){
    return INSTANCE.fb1_GetImageData(nUnit, pBmap);
}

public int fb1_GetEndorseStatus(int nUnit, IntByReference pType, int nFunc, tagMtrIjpSts pStutus){
    return INSTANCE.fb1_GetEndorseStatus(nUnit, pType, nFunc, pStutus);
}

public int fb1_SetDeviceInfo(int nUnit, int nDeviceInfoID, String pszIn){
    return INSTANCE.fb1_SetDeviceInfo(nUnit, nDeviceInfoID, pszIn);
}

public int fb1_SetBinaryInfo(int nUnit, int nSide, tagFb1BiInfo pBiInfo){
    return INSTANCE.fb1_SetBinaryInfo(nUnit, nSide, pBiInfo);
}

}

So the problem here is. I am will not reach Test2.DLL because where I actually trying to call the Interface is from Test1.DLL

I can Only Load Test1.DLL and tere is no way for me to Load Test2.DLL as another Instance. How can I reach the Test2.DLL just by Loading Test1.DLL as a parent.

Aizen
  • 1,807
  • 2
  • 14
  • 28

0 Answers0