|
как вызвать в VB функцию из DLL на VC?
|
|||
---|---|---|---|
#18+
Приветсвую коллег! объявление в VB Public Declare Function temp1 Lib "styk.dll" (ByVal ccc As Long, ByVal hhh As Long) As Long процедура VB обращения в DLL Dim sOut As String, sIn As String sIn = "1111" sOut = "2222" temp1 StrPtr(sIn), StrPtr(sOut) MsgBox sOut объявление в C++ extern "C" { __declspec(dllexport) BOOL temp1(BSTR DataNLP,BSTR BufOsh); } процедура к которой обращается VB BOOL temp1 (BSTR DataNLP,BSTR BufOsh) { ulong dl_soob; ulong dl_dsoob; char * bufso; char * bufdso; char * bufs; char * tmp; char * adrs; dl_soob=wcslen(DataNLP)+sizeof(char); bufs = (char *)malloc (dl_soob); WideCharToMultiByte(CP_ACP,NULL,DataNLP,-1,bufs,dl_soob,NULL,NULL); char sOut[]="ПРИВЕТ ОТ DLL !!!!!"; bufso = (char *)malloc (dl_soob+lstrlen(sOut)); memset((char *)bufso,' ',dl_soob); memcpy (bufso , bufs,dl_soob); strcat(bufso,sOut); LPWSTR pwsz=new WCHAR[lstrlen(bufso)*2+sizeof(WCHAR)]; MultiByteToWideChar(CP_ACP,NULL,bufso,-1,pwsz,lstrlen(bufso)*2+sizeof(WCHAR)); SysReAllocString(&BufOsh,pwsz); delete [] pwsz; free(bufs); free(bufso); return TRUE; } Если запускать в дебагере VC при собранном exe VB то всё проходит изумительно. Стоит только собрать тогда строка не изменятся в DLL. Может кто сталкивался или решал такие проблемы прошу помочь. С уважением, Андрей ... |
|||
:
Нравится:
Не нравится:
|
|||
16.10.2003, 17:37 |
|
|
start [/forum/topic.php?fid=60&tid=2170590]: |
0ms |
get settings: |
9ms |
get forum list: |
13ms |
check forum access: |
3ms |
check topic access: |
3ms |
track hit: |
59ms |
get topic data: |
11ms |
get forum data: |
3ms |
get page messages: |
29ms |
get tp. blocked users: |
1ms |
others: | 319ms |
total: | 450ms |
0 / 0 |