Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. MIDL_user_free

MIDL_user_free

Scheduled Pinned Locked Moved C / C++ / MFC
helpdebuggingquestionlearning
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    lucy 0
    wrote on last edited by
    #1

    I'm learning RPC (remote procedure call). I included "rpcndr.h", and add "Rpcrt4.lib" in object/library modules. When compiling, I got the following errors: Linking... interface_c.obj : error LNK2001: unresolved external symbol _MIDL_user_free@4 interface_c.obj : error LNK2001: unresolved external symbol _MIDL_user_allocate@4 Debug/22_rpc.exe : fatal error LNK1120: 2 unresolved externals Error executing link.exe. what am I missing? I am using VC6.0. Thanks a lot for any help!

    H 1 Reply Last reply
    0
    • L lucy 0

      I'm learning RPC (remote procedure call). I included "rpcndr.h", and add "Rpcrt4.lib" in object/library modules. When compiling, I got the following errors: Linking... interface_c.obj : error LNK2001: unresolved external symbol _MIDL_user_free@4 interface_c.obj : error LNK2001: unresolved external symbol _MIDL_user_allocate@4 Debug/22_rpc.exe : fatal error LNK1120: 2 unresolved externals Error executing link.exe. what am I missing? I am using VC6.0. Thanks a lot for any help!

      H Offline
      H Offline
      Hans Dietrich
      wrote on last edited by
      #2

      According to MSDN: The midl_user_allocate function is a procedure that must be supplied by developers of RPC applications. It allocates memory for the RPC stubs and library routines. Example:

      void __RPC_FAR * __RPC_USER midl_user_allocate(size_t cBytes)
      {
      return ((void __RPC_FAR *) malloc(cBytes));
      }

      The midl_user_free function also must be written by the developer. Example:

      void __RPC_API midl_user_free(void __RPC_FAR * p)
      {
      free(p);
      }

      Best wishes, Hans

      L 1 Reply Last reply
      0
      • H Hans Dietrich

        According to MSDN: The midl_user_allocate function is a procedure that must be supplied by developers of RPC applications. It allocates memory for the RPC stubs and library routines. Example:

        void __RPC_FAR * __RPC_USER midl_user_allocate(size_t cBytes)
        {
        return ((void __RPC_FAR *) malloc(cBytes));
        }

        The midl_user_free function also must be written by the developer. Example:

        void __RPC_API midl_user_free(void __RPC_FAR * p)
        {
        free(p);
        }

        Best wishes, Hans

        L Offline
        L Offline
        lucy 0
        wrote on last edited by
        #3

        I see why it's called _user_ now. At first I thought it's my RpcRt4.lib which is not up-to-date. Thank you very much, Hans.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups