Create dll library in C # and use it in a C project

1

I tell you that I'm doing a project in LabWindows / CVI 2012 which is an ANSI C development environment, where a couple of days ago I've been trying to execute command lines in windows to boot the bootloader in an ATMEGA328P, and they suggested using the function system () or LaunchExecutableEx () but in neither of the two I get the result that it returns when executing the command lines (avrdude -v -patmega328p -cstk500v1 -PCOM7 -b19200 -Uflash: w: C: \ ATmegaBOOT_168_atmega328.hex: i -Ulock: w: 0x0F: m), so I tried it in C # and I told them that I managed to get the result I want. Now what I would like to do is a dll library to be able to use it in my C project, but my problem is that I can not find good information. Someone who can help me with this problem please, thanks in advance (I leave attached the code in C # to record the bootloader in the ATMEGA328P).

        System.Diagnostics.ProcessStartInfo procStartInfo = new 
        System.Diagnostics.ProcessStartInfo("cmd", "/c" + "avrdude -v - patmega328p -cstk500v1 -PCOM7 -b19200 -Uflash:w:C:/ATmegaBOOT_168_atmega328.hex:i -Ulock:w:0x0F:m");
        procStartInfo.RedirectStandardOutput = true;
        procStartInfo.UseShellExecute = false;
        procStartInfo.CreateNoWindow = true;
        procStartInfo.WindowStyle = ProcessWindowStyle.Hidden;
        System.Diagnostics.Process proc = new System.Diagnostics.Process();
        proc.StartInfo = procStartInfo;
        proc.Start();
        string result = proc.StandardOutput.ReadToEnd();
        string successfulResult = "avrdude: safemode: lfuse reads as FF\n" +
                                  "avrdude: safemode: hfuse reads as DA\n" +
                                  "avrdude: safemode: efuse reads as 5\n" +
                                  "avrdude: safemode: lfuse reads as FF\n" +
                                  "avrdude: safemode: hfuse reads as DA\n" +
                                  "avrdude: safemode: efuse reads as 5\n";
        if (String.Compare(result, successfulResult) > 0)
        {
            Console.WriteLine("Bootloader Loaded");
        }
        else
        {
            Console.WriteLine("Error loading bootloader");
        }
    
asked by Cesar Herbas 24.07.2018 в 16:01
source

0 answers