//calldll.c
#include "windows.h"
typedef void (*FreematPrint)(const char*);
FreematPrint FreematConsole;
__declspec(dllexport) void freemat_io_handler(FreematPrint pname) { FreematConsole = pname; }
__declspec(dllexport) void calldll(int i)
{
char sbuf[1024];
sprintf(sbuf,"Freemat console print. You are passing an integer %d:sizeof(int)=%d bytes\n",i,sizeof(int));
FreematConsole(sbuf);
}
%%calldll.m
import('calldll.dll','calldll','mCalldll','void', 'int32 st');
mCalldll(1232138);
REM makedll.bat
tcc -shared calldll.c -ocalldll.dll
----- Freemat console snapshot --------
--> calldll
Freemat console print. You are passing an integer 1232138:sizeof(int)=4 bytes
-->
沒有留言:
張貼留言