No exeptions Just not getting a return value back
veselin_iordanov
Posts
-
Unmanaged Dlls ? -
Unmanaged Dlls ?dll is in the same directory but C# code dont work in this way
-
Unmanaged Dlls ?typedef BYTE *BBSTR; BBSTR AllocString(UINT len) { return (BBSTR) SysAllocStringByteLen(NULL, len); } void ReAllocString(BBSTR *pbbstr, UINT len) { BBSTR tstr; tstr = AllocString(len); if(len > StringLen(*pbbstr)) len = StringLen(*pbbstr); if(len > 0) memcpy(tstr, *pbbstr, len); FreeString(*pbbstr); *pbbstr = tstr; } BBSTR __stdcall decode(BBSTR data) { UINT i, j; BBSTR outstr; outstr = AllocString(StringLen(data) - 1); i = 0; j = 0; while(i + 1 < StringLen(data)) { //first to 2nd last char if(data[i] == 0x07) { i++; outstr[j] = data[i] ^ 0x0F; } else { outstr[j] = data[i]; } i++; j++; } ReAllocString(&outstr, j); return outstr; }
in VB this is defined likePublic Declare Function decode Lib "endecode.dll" (ByVal Data As String) As String
in C#[DllImport("endecode.dll",CharSet=CharSet.ASCII, CallingConvention=CallingConvention.StdCall)] static public extern string decode ([MarshalAs(UnmanagedType.LPStr)] string Data) ;
but dont work -
Unmanaged Dlls ?i try it result is the same :(
-
Unmanaged Dlls ?no error just dont retutn anything
-
Unmanaged Dlls ?ok i have this case and try almost everething and dont work .. C++ Dll: typedef BYTE *CCSTR; CCSTR __stdcall Example(CCSTR data) { //do somthing } C#: [DllImport("test.dll",CharSet=CharSet.Auto, CallingConvention=CallingConvention.StdCall)] static public extern string Example([MarshalAs(UnmanagedType.LPStr)] string Data) ; if someone have idea what can be wrong that will be very cool 10x in advance PS: Sry about my bad english
-
Array of pointers to a functionsfound the problem 10x alot i must call function in this way (this->*handler[i])(data); .. dont know way its look totaly stuped for me .. but its work :D 10x for the help
-
Array of pointers to a functionsok i have very strange problem in first case everything is ok
int (*handler[15])(int parm); int user_trans_quit(int parm); int user_trans_quit(int parm){ printf("Just a test %d", parm); return 0; } int _tmain(int argc, _TCHAR* argv[]) { handler[1]=user_trans_quit; handler[1](1); }
but when i try to meke OO compiler give me this error "error C2064: term does not evaluate to a function taking 1 arguments"#pragma once class PacketHandler { private : public: PacketHandler(void); ~PacketHandler(void); int LoginAck(char *parm); void Action(int i, char *data); int (PacketHandler::*handler[255])(char *parm); }; .... #include "StdAfx.h" #include ".\packethandler.h" PacketHandler::PacketHandler(void) { handler[1]=LoginAck; } PacketHandler::~PacketHandler(void) { } int PacketHandler::LoginAck(char *parm) { return 0; } void PacketHandler::Action(int i, char *data) { handler[i](data); //error C2064: term does not evaluate to a function taking 1 arguments }
10x in advance PS:sry about my bad english