Click here to Skip to main content
15,897,518 members
Home / Discussions / C#
   

C#

 
GeneralRe: KeyDown event and Tab Indexes trouble ? Pin
Henry Minute12-Aug-09 8:11
Henry Minute12-Aug-09 8:11 
QuestionJPEG Decoder\Encoder in C# Pin
Gilad Kapelushnik12-Aug-09 4:47
Gilad Kapelushnik12-Aug-09 4:47 
AnswerRe: JPEG Decoder\Encoder in C# Pin
0x3c012-Aug-09 4:54
0x3c012-Aug-09 4:54 
GeneralRe: JPEG Decoder\Encoder in C# Pin
Gilad Kapelushnik12-Aug-09 5:01
Gilad Kapelushnik12-Aug-09 5:01 
AnswerRe: JPEG Decoder\Encoder in C# Pin
Dave Kreskowiak12-Aug-09 4:57
mveDave Kreskowiak12-Aug-09 4:57 
GeneralRe: JPEG Decoder\Encoder in C# Pin
Gilad Kapelushnik12-Aug-09 5:04
Gilad Kapelushnik12-Aug-09 5:04 
GeneralRe: JPEG Decoder\Encoder in C# Pin
Dave Kreskowiak12-Aug-09 6:25
mveDave Kreskowiak12-Aug-09 6:25 
QuestionInterfacing managed C# code and a C-shared Matlab library Pin
Jan Arjen Kraak12-Aug-09 4:44
Jan Arjen Kraak12-Aug-09 4:44 
Hi,
I've created a c-shared matlab library, which I want to use in my solution.
Using DllImport I can initialize the matlab environment, initialize my matlab model
and send parameters to this dll.
All works wel..., except I can't get the results!

In matlab, I've got a simple (test) function which returns a fixed value: 1234.
The created library has the following .h file:
extern LIB_Matlab_Test_C_API bool MW_CALL_CONV mlfMatlab_test(int nargout
                                                              , mxArray** steps
                                                              , mxArray* test_string
                                                              , mxArray* nog_een_test_string);


This is how I interface to the dll:
/// <summary>
        /// One and only function in the matlab model
        /// </summary>
        /// <param name="myString">string</param>
        /// <returns>True if successfull, false otherwise</returns>
        [DllImport("Matlab_Test.dll", EntryPoint = "mlfMatlab_test")]
        static extern bool Matlab_Test(
            [Out][MarshalAs(UnmanagedType.I4)]int nargout,
            IntPtr return_value,
            [In][MarshalAs(UnmanagedType.LPStr)]string myString,
            [In][MarshalAs(UnmanagedType.LPStr)]string mySecondString);


And finally, calling the function:
int nargout = 1;
                    IntPtr pbuf = Marshal.AllocHGlobal(256);
                    Matlab_Test(nargout, pbuf,"dummy string", "yet another dummy string");
                    int sOut = Marshal.ReadInt32(pbuf);
                    Console.WriteLine("\t\tsucceeded! Value = {0}", sOut);
                    Marshal.FreeHGlobal(pbuf);


The value of sOut always remains zero Mad | :mad:

Does anyone have an idea of what I'm doing wrong here? Confused | :confused:

-- Stupidity should be painfull --

AnswerRe: Interfacing managed C# code and a C-shared Matlab library Pin
Luc Pattyn12-Aug-09 7:46
sitebuilderLuc Pattyn12-Aug-09 7:46 
QuestionRe: Interfacing managed C# code and a C-shared Matlab library Pin
Cracked-Down6-Sep-09 23:21
Cracked-Down6-Sep-09 23:21 
AnswerRe: Interfacing managed C# code and a C-shared Matlab library Pin
Jan Arjen Kraak7-Sep-09 4:01
Jan Arjen Kraak7-Sep-09 4:01 
GeneralRe: Interfacing managed C# code and a C-shared Matlab library Pin
Cracked-Down7-Sep-09 4:17
Cracked-Down7-Sep-09 4:17 
GeneralRe: Interfacing managed C# code and a C-shared Matlab library Pin
nizar3213-Nov-09 11:24
nizar3213-Nov-09 11:24 
GeneralRe: Interfacing managed C# code and a C-shared Matlab library Pin
Jan Arjen Kraak19-Nov-09 20:43
Jan Arjen Kraak19-Nov-09 20:43 
GeneralRe: Interfacing managed C# code and a C-shared Matlab library2 Pin
nizar3213-Nov-09 11:24
nizar3213-Nov-09 11:24 
GeneralRe: Interfacing managed C# code and a C-shared Matlab library Pin
nizar3213-Nov-09 11:49
nizar3213-Nov-09 11:49 
GeneralRe: Interfacing managed C# code and a C-shared Matlab library Pin
Jan Arjen Kraak19-Nov-09 20:45
Jan Arjen Kraak19-Nov-09 20:45 
QuestionCode coverage Pin
K.v.S.12-Aug-09 4:20
K.v.S.12-Aug-09 4:20 
AnswerRe: Code coverage Pin
Luc Pattyn12-Aug-09 7:50
sitebuilderLuc Pattyn12-Aug-09 7:50 
QuestionQuerystring needed to set to empty Pin
kKamel12-Aug-09 4:08
kKamel12-Aug-09 4:08 
GeneralRe: Querystring needed to set to empty Pin
musefan12-Aug-09 4:54
musefan12-Aug-09 4:54 
GeneralRe: Querystring needed to set to empty Pin
kKamel12-Aug-09 5:04
kKamel12-Aug-09 5:04 
GeneralRe: Querystring needed to set to empty Pin
musefan12-Aug-09 5:07
musefan12-Aug-09 5:07 
AnswerRe: Querystring needed to set to empty Pin
Coding C#12-Aug-09 21:35
Coding C#12-Aug-09 21:35 
QuestionOpen Child Form and threading Pin
Saamir12-Aug-09 3:50
Saamir12-Aug-09 3:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.