フィルターのクリア

loading an existing dll

3 ビュー (過去 30 日間)
JH
JH 2013 年 8 月 28 日
Hi all-
I want write a C++ s-function that accesses/loads an existing dll. I have an existing example calling the dll using fortran:
REAL(4) :: avrSWAP(*)
INTEGER(4) :: aviFAIL
INTEGER(1) :: accINFILE(*)
INTEGER(1) :: avcMSG(*)
INTEGER(1) :: avcOUTNAME(*)
INTEGER(HANDLE) :: FileAddr
INTEGER(LPVOID) :: ProcAddr
POINTER ( DLL_ProcAddr, DLL_Procedure )
INTERFACE
SUBROUTINE DLL_Procedure(avrSWAP,aviFAIL,accINFILE,avcOUTNAME,avcMSG)
REAL(4) :: avrSWAP (*)
INTEGER(4) :: aviFAIL
INTEGER(1) :: accINFILE (*)
INTEGER(1) :: avcMSG (*)
INTEGER(1) :: avcOUTNAME(*)
END SUBROUTINE DLL_Procedure
END INTERFACE
FileAddr = LoadLibrary( "DISCON.DLL" )
ProcAddr = GetProcAddress( DLL_Trgt%FileAddr, "DISCON" )
DLL_ProcAddr = ProcAddr
CALL DLL_Procedure ( avrSWAP, aviFAIL, accINFILE, avcOUTNAME, avcMSG )
Is there an example of doing something similar from a C++ s-function? The interface is clear from the fortran code, but I do not have the header file or the code for this dll. I am quite confident that I can write/hack my own C++ header for it if that is necessary. If anyone wants to take a crack at actually writing the necessary C++ code to load and call the dll, that would be absolutely terrific. Otherwise, just a simple example of a C++ s-function calling any dll would be fantastic as well.
Thanks for any and all help,
-Jason
  1 件のコメント
Kaustubha Govind
Kaustubha Govind 2013 年 8 月 28 日
JH: S-functions support standard C usage (I think it's the C99 standard, but it probably depends on what MEX compiler you're using), so I would recommend that you attempt to first write standalone C/C++ code that uses the DLL outside of MATLAB, and test it out. Once you have that working, you can use the same type of call in an S-function.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeIntroduction to Installation and Licensing についてさらに検索

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by