Get the DLL string (memory allocated for DLL)

Hi, I'm aware there are a lot of discussions around this topic, but there are a lot of variations and I've never used before LabVIEW, and I seem to have a hard time at a very basic level, so I hope someone can help me with the below simple specific test case to put me on the right track before I pull my hair remaining.

I've created a DLL with a single function "GenerateGreeting". When it is called, it allocates enough memory for the string "Hello World!" \0"at the pGreeting of pointer, copy this string to the pointer and sets the GreetingLength parameter to the number of allocated bytes (in the DLL in the end, I want to use, there is a DLL function to free the memory allocated for this way).

I created a header file to go with the DLL containing the following line.

extern __declspec(dllimport) int __stdcall GenerateGreeting(char* &pGreeting, int &GreetingLength);

I then imported the LabVIEW file using the import Shared Library Wizard. That created a "generate Greeting.vi' and everything seems somewhat sensitive for me (although this does not mean a lot right now). When I run the vi, the ' GreetingLength on ' display correctly '13', the length of the string, but "pGreeting out" shows only three or four characters (which vary in each race), place of the string that is expected of junk.

The pGreeting parameter is set to the 'String' type, the string "String pointer C" format, size currently Minimum of 4095. I think the problem is that the DLL wants to allocate memory for pGreeting; the caller is supposed to pass a unallocated pointer and let the DLL allocates memory for the string the right amount, but LabVIEW expected the DLL to write in its buffer préallouée. How to with LabVIEW? Most of the functions in the DLL in the end, I want to use work this way, so I hope that's possible. Or I have to rewrite all my DLL functions to use buffers allocated by the appellant?

The vi , header and the DLL are atteched, tips appreciated. Edit - cannot attach the dll or the headers.

tony_si wrote:

extern __declspec(dllimport) int __stdcall GenerateGreeting(char* &pGreeting, int &GreetingLength);

Although char * & pGreeting is actually a thing of C++ (no C compiler I know would accept it) and this basically means that the char pointer is passed as a reference. So, technically, it's a double referenced pointer, however nothing in C++ Specifies that reference parameters should be implemented as a pointer at the hardware level. So free to decide to use some other possible MECHANISM that takes the target CPU architecture support a C compiler constructor. However, for the C++ compilers, I know it's really just syntactic sugar and is implemented internally as a pointer.

LabVIEW has no type of data that allows to configure this directly. You will have to configure it as a whole size pointer passed as a pointer value and then use a call MoveBlock() or the support VI GetValuePtr() to copy the data on the pointer in a string of LabVIEW.

AND: You need to know how the DLL allocates the pointer so that you can deallocate it correctly after each call to this function. Otherwise you probably create a leak memory, since you say that the first 4 bytes in the returned buffer always change, this feature seems to assign to each run of a new buffer that you want to deallocate correctly. Unless the DLL uses a Windows such as HeapAlloc() API function for this, it should also export a function according to deallocate the buffer. Functions like malloc() and free() from the C runtime cannot always be applied in the same version between the caller and callee, so that calling free() by calling on a buffer that has been allocated with malloc() in the DLL may not work on the same segment of memory and result in undefined behavior.

Tags: NI Software

Similar Questions

  • How can I get the dll into the GAC on web servers (Win2008 R2/IIS 7) that don't have GACUTIL on them?

    I followed the steps described in KB911816, but I can't make it work.

    Two questions:

    How can I get the dll into the GAC on web servers (Win2008 R2/IIS 7) that don't have GACUTIL on them?

    Where should I put the reference to the dll in Web.config?

    OT:

    KB911816

    Hi Mike,.

    Refer to:

    https://TechNet.Microsoft.com/en-us/library/gg607836 (v = ws.10) .aspx

    https://msdn.Microsoft.com/en-us/library/ee265628%28V=BTS.10%29.aspx?f=255&MSPPError=-2147217396

    Please post your question here for improving assistance:

    https://social.technet.Microsoft.com/forums/WindowsServer/en-us/home?category=WindowsServer

  • Maximum memory allocation for HP Pavilion dv7-7010us

    HP Pavilion dv7-7010us
    Windows 7 (64-bit)

    Hello!
    As shown in the topic, I'm looking for the maximum memory allocation for my new HP Pavilion dv7-7010us notebook.

    I am aware that my computer has two memory slots filled a 2 GB DDR3 SDRAM and a 4 GB DDR3 SDRAM.
    If anyone could also tell me the perfect combination of chip (2 x 4 GB, 2x16GB, etc.) to get the maximum memory allocation, that would be much appreciated. Thank you!
    -Angelo

    Hi, Angelo:

    Here is the link to the service manual for your laptop.

    http://h10032.www1.HP.com/CTG/manual/c03221579.PDF

    Supported memory configurations are in Chapter 1, page 4.

    Paul

  • Windows XP in IE5 ~ runs slowly, freezes. Get the message: virtual memory is low. Some applications will not work.

    Windows XP in IE5 ~ runs slowly, freezes.

    Get the message: virtual memory is low.

    According to the report of diagnosis of Norton 360: need to upgrade RAM for best performance.

    Need to clean IE (32 MB) & temp of Windows (60 MB) files every day.

    The speed is 5.2 download,.6 upload. Turns fast in 'Safe Mode '.

    What do you do now?

    Thank you

    What Windows XP SP updates are installed.

    Internet Exp [lorer 5 is long it's sell by date!] Why have you not updated to a later not necessarily the latest version of Internet Explorer.

    What is the processor and RAM how much your computer have? Make a right-click on the icon my computer on your desktop and select properties for this information.

    Try Ctrl + Alt + Delete, select Task Manager, and then click the performance tab. Under Commit Charge, which is the Total, limit, and the pic?

    I'd be interested to see a report of Disk Defragmenter. Open Disk Defragmenter and click analysis. Select view report, and then click Save as and save. Now find VolumeC.txt in your My Documents folder. Open the file, and place the cursor anywhere in the file, select Edition, select all to select all the text and copy and paste into the body of your message. To do this, before you run Disk Defragmenter because it is more informative.

    Norton 360 is a bad choice of security for any computer software but especially so for an old computer. There is a lot more suitable alternatives to freeware.

  • When you try to scan a document on HP Officejet Pro 8500 get the message 'Insert MEMORY' or 'no scan options '.

    When you try to scan a document on HP Officejet Pro 8500 get the message 'Insert MEMORY' or 'no scan options '.

    Original title: I scan a Document

    Hi Robert,.

    The instructions in the article are valid for the model of your scanner. Click the plus sign next to your operating system for more information.

    http://h10025.www1.HP.com/ewfrf/wc/document?DocName=c02450835&cc=us&DLC=en&LC=en&JumpID=reg_r1002_usen_c-001_title_r0001#N6626

    If the problem persists please post the request on the HP support for additional support:

    http://WWW8.HP.com/us/en/support.html

    Please follow these recommended steps and post if you still experience the problem. I will be happy to provide you with additional options.

  • Whenever I caonnect my internet home, McAfee start poping of alerts, and after a few minutes (5-10 min) get the errors of generic host for Win32 process has encountered a problem and must be closed.

    Generic host win32 problem...

    HI, I have soundcards XP SP2, version 2002. Whenever I caonnect my internet home, McAfee start poping of alerts, and after a few minutes (5-10 min) get the errors of generic host for Win32 process has encountered a problem and must be closed. After all that, my internet stops working and against hepatitis a to erboot to make it work again. Help, please

    Hello

    ·         Did you do changes on the computer before the show?

    Follow these methods.

    Method 1: Follow these steps:

    Step 1: Start the computer in safe mode with network and check if the problem persists.

    Step 2: If the problem does not still in safe mode, perform a clean boot to see if there is a software conflict as the clean boot helps eliminate software conflicts.

    Note: After completing the steps in the clean boot troubleshooting, follow the section How to configure Windows to use a Normal startup state of the link to return the computer to a Normal startupmode.

    After the clean boot used to resolve the problem, you can follow these steps to configure Windows XP to start normally.

    (a) click Start, run.

    (b) type msconfigand click OK.

    (c) the System Configuration Utility dialog box appears.

    (d) click the general tab, click Normal startup - load all services and device drivers and then click OK.

    (e) when you are prompted, click on restart to restart the computer.

    Method 2: Temporarily disable the security software.

    Note: Antivirus software can help protect your computer against viruses and other security threats. In most cases, you should not disable your antivirus software. If you do not disable temporarily to install other software, you must reactivate as soon as you are finished. If you are connected to the Internet or a network during the time that your antivirus software is disabled, your computer is vulnerable to attacks.

    Method 3: Follow the steps in the article.

    How to troubleshoot a network home in Windows XP

    Windows wireless and wired network connection problems

    For reference:

    How to reset the Protocol Internet (TCP/IP)

  • When trying to start the disk check procedure, I get the answer, "cannot open volume for direct access. How can I fix?

    I get the above answer everytime I turn on the computer. (This is with AutoCorrect blocks checked). If I leave blocks unchecked, it follows a procedure 3 pass without rebooting and does not produce a result.

    * original title - to try to start the procedure of checking disk I get the answer, "cannot open volume for direct access. How can I fix? I ran the GET Microsoft virus check tnd an own result.*

    The application-specific permission settings do not authorization for the application server COM with the CLSID
    {DCBCA92E-7DBE-4EDA-8B7B-3AAEA4DD412B}
    the user NT AUTHORITY\SYSTEM SID (S-1-5-18). This security permission can be modified using the Component Services administrative tool.

    In the opposite case

    http://blog.ray1.NET/2008/01/WinXP-SP3-DCOM-system-error-dcbca92e.html

    http://TechNet.Microsoft.com/en-us/network/bb545879

    http://www.blackviper.com/wiki/Network_Access_Protection_Agent

  • Where can I get the spare parts (circuit boards) for my HP 2509 m monitor?

    Where can I get the spare parts (circuit boards) for my HP 2509 m monitor?

    Hello tsmit32,

    Here is a link to the parts list of what HP considers to be user replaceable.

    Replaceable parts by the user (Europe, Middle East and Africa)

    Since the part is not on the list as a replaceable user then HP does not provide the part for sale. The circuit boards are going to be hard to find, perhaps ebay and other online retailers research is your best option.

    The other option that you have is to create your own heel to tear the other monitors that ppl may be getting rid of. If you can find a job of monitoring of 2509 m on ebay with a fairly cheap crack screen then you essentially buy the guts and that's what you're looking for.

  • Switch to the correct encryption certificate I get the error: "Key not valid for use is specified state."

    Used
    Now cannot open encrypted files.

    When you try to pass the correct encryption certificate I get the error:
    "Key not valid for use is specified state."

    See this http://answers.microsoft.com/en-us/windows/forum/windows_7-security/keeping-passwords-secure-microsoft-policy-on/39f56ef0-5d68-41ad-9daa-6e6019c25d37

    It is as it's supposed to as an anti theft precautions. I mean that data is encrypted, if somebody stole your hard drive and the hard drive boots and the other account it can receive data.

    If you not export recovery certificates and encrypting the data, you cannot redo the decryption.

    http://Windows.Microsoft.com/en-us/Windows/back-up-EFS-certificate#1TC=Windows-7

    If it's a default domain recovery agent. admin area. If it's home, to look for recovery certified you have exported.

    But third-party tools are there if you can remember old password the is to encrypt you can recover. But they are not free... and premium software is not be recommended or guided through support free forum due to the effort of preventing unnecessary advertising.

    You can do you own research about recovering data... just try to get you using the favorite search engine... "Restore access to encrypted EFS format files" or "Advanced EFS Data Recovery.

    Many more free guides will be available... Just keep in mind this is not a method to escape... you must remember your old password at least for decryption in the case where you export a certificate.

  • Where can I get the SRS Premium Sound Technology for my g7-1365dx

    I recently did a clean installation of Windows 8 on my HP Pavilion laptop 1365dx g7. I would like to know where I can get the SRS Premium Sound Technology for it. (the same one that was / is on my Windows 7 Home Premium)

    * I am dual-booting Windows 8 and my original Windows 7 Home Premium. Can I extract the files of this installation? *

    Any help would be greatly appreciated. In addition, I want to get all software of this facility (YouCam full HP Software Wizard, etc.)

    Thank you

    Stan [personal information deleted]

    If you want to install any software supplied with unit, then you will need to find the swsetup folder. To find the right folder program, will make you more than likely need to try running Setup in each file to find what you are looking for. The installer must list what it is and it can be cancelled. Some may have a file readme.txt as well, so this could be another way, if it is present.

    If you go to the folder of the application via the context menu, it will take you to the program folder files, that it has been installed. I can't guarantee a functioning copy / paste from there. Some programs must go through the registry to create a registry key to work and this is done during the installation process. Honestly, you should be able to access a partition from Windows. The partition of Windows 8 should be accessible from Windows 7 and the Windows 7 partition should be accessible from Windows 8.

  • I can't get the file number I need for the license transfer process. Help, please.

    I can't get the file number I need for the license transfer process. Help, please.

    To the link below, click on the still need help? the option in the blue box below and choose the option to chat...
    Make sure that you are logged on the Adobe site, having cookies enabled, clearing your cookie cache.  If it fails to connect, try to use another browser.

    Get help from cat with orders, refunds and exchanges (non - CC)
    http://helpx.Adobe.com/x-productkb/global/service-b.html ( http://adobe.ly/1d3k3a5 )

  • The blur tool.  I can not get the blur tool to work for me.

    The blur tool.  I used Photoshop for photo editing until 2 years ago.  I just started to use Photoshop again, and I can't get the blur tool to work for me.  I just does not affect the pixels at all.  I think I'm following the correct process for click on the blur tool and then configure the brush to do my procedure of blur.  Help, please.

    Hi Robert,.

    Please do not forget that you work directly on the layer on which is the image you want to blur. Where you work on an empty layer, make sure that your auto to check the ' sample all layers ' (mine is unchecked) property in the top bar. Also, as has been suggested previously, check if the blending mode is set to normal.

    If the problem persists, please let us know,

    Kind regards
    Martin Benes

  • Adobe story online is not loading. I just get the loading bar going on for hours. I restarted my browser, deleted my cookies, installed the latest version of Flash and still no loading.

    Adobe story online is not loading. I just get the loading bar going on for hours. I restarted my browser, deleted my cookies, installed the latest version of Flash and still no loading.

    For security reasons, browsers tend to block flash on a site content if the system does not have the latest version of flash player.

    Try to get the last being here: https://get.adobe.com/flashplayer

  • Get the matrix of global position for each character of text

    This message follows this related post.

    I need to get the position and orientation of the first and the last character in a text frame art, in other words, I need its matrix.

    There are a number of functions of the API that is supposed to help you; An excerpt from the ATESuites.h file

    / * Return of this race transformation matrix.

    The returned array spesify transformation complete the given execution.  You must transform the original by IGlyphRun::GetOrigins() and

    Concat with ITextFrame::GetMatrix() in order to get the location of the glyphs.

    */

    ATEErr (* GetMatrix) (GlyphRunRef glyphrun, ASRealMatrix * ret);

    Therefore, get the matrix of the first character or glyph should look like this:

    AIErr

    VMGetFirstTextMatrix (AIArtHandle textArt, AIRealMatrix * matrix)

    {

    ASRealMatrix frameMatrix, glyphMatrix;

    ASRealPoint firstPoint;

    Try

    {

    TextFrameRef ateTextRef;

    sAITextFrame-> GetATETextFrame (textArt, & ateTextRef);

    TextFrame ITextFrame (ateTextRef);

    ITextLinesIterator lnItr = textFrame.GetTextLinesIterator ();

    TxtLine = lnItr.Item () ITextLine;

    IGlyphRunsIterator grItr = txtLine.GetGlyphRunsIterator ();

    GlyphRun IGlyphRun = grItr.Item ();

    IArrayRealPoint pointArray = glyphRun.GetOrigins ();

    firstPoint = pointArray.Item (0);   dating bad values!

    frameMatrix = textFrame.GetMatrix ();

    glyphMatrix = glyphRun.GetMatrix ();

    Scissor-> AIRealMatrixConcatTranslate (& glyphMatrix,

    (firstPoint.h, firstPoint.v);

    Scissor-> AIRealMatrixConcat ((AIRealMatrix *) & glyphMatrix,)

    (AIRealMatrix *) & frameMatrix,.

    matrix);

    return kNoErr.

    }

    catch (ATE::Exception e)

    {

    return e.error;

    }

    return kNoErr.

    }

    But the coordinates is returned in frameMatrix (tx and ty) or the firstPoint are clearly wrong. It seems they have a lag that is allmost constant.  The values of x are about 7664 too great points (give and take a few decimals), and values are about 7893 too large (also give and take a few decimals).

    I'm puzzled by this, reall because I need to get precise positions...

    Well, it worked eventually.

    The ITextFrame::GetMatrix() method generally returns an identity matrix, unless I moved or transformed the object frame of text on the artboard.  For example, if I duplicated a text image object by dragging the object while pressing the alt key, this matrix will be transformation relative to the object that it was created. Since it is a relative transformation, it is not hard or soft coordinates, so it is foolish to harden or soften (in fact, you shouldn't do).

    Then the IGlyphRun::GetMatrix() method typically returns the identity matrix, but will contain a rotation for example, if the object is a text on a path.

    Finally, the IGlyphRun::GetOrigins() method returns hard coordinates for each glyph, but without the frame matrix transformation.  This method is insensitive to the GetCoordinateSystem / SetCoordinateSystem functions of the following system and returns the hard coordinates launch.

    Thus, in order to get the actual art contact information for the Board of Directors of a glyph, the following code will do:

        IArrayRealPoint pointArray = glyphRun.GetOrigins();

        AIRealPoint firstPoint = pointArray.Item(0);

        AIRealMatrix frameMatrix = textFrame.GetMatrix();

        sMath->AIRealMatrixXformPoint( &frameMatrix, &firstPoint, &hardPoint);

        sHardSoft->AIRealPointSoften( &hardPoint, &glyphPoint);

    In order to obtain the matrix of the absolute position of the first glyph of an art of text frame, the following function seems to work:

    AIErr

    GetFirstTextMatrix(  AIArtHandle textArt, AIRealMatrix *matrix)

    {

        ASRealMatrix frameMatrix, glyphMatrix;

        ASRealPoint firstPoint, softPoint, hardPoint;

        try

        {

            TextFrameRef ateTextRef;

            sAITextFrame->GetATETextFrame( textArt, &ateTextRef);

            ITextFrame textFrame( ateTextRef);

     

            ITextLinesIterator lnItr = textFrame.GetTextLinesIterator();

            ITextLine txtLine = lnItr.Item();   

     

            IGlyphRunsIterator grItr = txtLine.GetGlyphRunsIterator();

            IGlyphRun glyphRun = grItr.Item();

     

            IArrayRealPoint pointArray = glyphRun.GetOrigins();

            firstPoint = pointArray.Item(0);

            sHardSoft->AIRealPointSoften( &firstPoint, &softPoint);

     

            frameMatrix = textFrame.GetMatrix();

            glyphMatrix = glyphRun.GetMatrix();

     

            sMath->AIRealMatrixXformPoint( &frameMatrix, &firstPoint, &hardPoint);

            sHardSoft->AIRealPointSoften( &hardPoint, &softPoint);

     

            sMath->AIRealMatrixConcat( (AIRealMatrix*) &glyphMatrix,

                      (AIRealMatrix*) &frameMatrix,

                      matrix);

     

            matrix->tx = softPoint.h;

            matrix->ty = softPoint.v;

     

            return kNoErr; 

        }

        catch (ATE::Exception e)

        {

            return e.error;

        }

    }

    But, this has not come easily, and I must be allowed to blame poor documentation on this subject...

    Agnar

  • CTL3D32. Error DLL when you try to install MSOffice97 with Vista - how can I get the dll file in my registry?

    Try to install Office97 on my Vista PC. I get the message "this application using CTL3D32. DLL which has not been properly installed. CTL3D32. DLL must be installed in the Windows system directory. "I did the CTL3D32 in my registry and do not know how to get it in there? Help :)

    Office 97 is no longer supported by Microsoft.

    http://www.Microsoft.com/Windows/compatibility/Windows-Vista/search.aspx?type=software&s=Microsoft%20Office%2097

    And above his side of Vista compatibility is: recommended measures, to pay the upgrade.

    For further questions to the office:

    http://www.Microsoft.com/Office/Community/en-us/flyoutoverview.mspx

    Office newsgroups

    http://www.Microsoft.com/Office/Community/en-us/default.mspx?DG=Microsoft.public.Office.misc&lang=en&CR=us

    Discussions of general issues of the Office.

    They will help you with your office questions in the newsgroups Office above.

    See you soon. Mick Murphy - Microsoft partner

Maybe you are looking for

  • Export photos with information

    How to export photos from my library while and at the same time keep the description of the photo taken > <

  • P6-2010: new video on hp pavilion p6-2010 card

    Hello I have a desktop HP pavilion p6-2010 and I want a new video card, so I can play some of the games of "new". For example, gtx 1060. It works on my pc? I heard that this motherboard does not work with other cards. Help, please.

  • KB977816 installation fails and killed her.

    KB977816 installation fails every time but returned without the notification of update! Moreover, the first attempt to update killed my sound. My system is Win2k (I know that it is no longer supported, but I still need to use some legacy programs).

  • DV7: DV7 SSD

    Hi, I have a DV7 with core i7 2, 2 G, I would like to know the SSD drive which is adequate, I Don t know if he sataIII or II, anyone know if RAM max memory is 16 GB? Best regards!

  • Visual studio premium 2012 is incompatible with windows 7 ultimate

    Hello, I am doing my project in visual studio 2012, it works well at first, but after some time it displays error incompatible application with this version of windows.what can I do now?