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#
  4. Calling a DLL from C#

Calling a DLL from C#

Scheduled Pinned Locked Moved C#
csharphelpquestion
5 Posts 3 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.
  • E Offline
    E Offline
    E6AD
    wrote on last edited by
    #1

    HI All, I am trying to call a function from a dll. One of its parameters is a structure that I will need later to call another function from another dll but the problem is that I don't know its detailed structure to be able to marshall it in C#. I am not interested in accessing the struc:confused:ture's attributes,it's a temporary step for me before calling the other function. However,it must be accuartely done in order to pass a correct argument to the other function. Can I just marshal the unknow datatypes within the structure as it they were "void"? Any ideas or suggestions? It's really has been puzzling me for a time now and I can't reach a solution Thanks and Best Regards, E.A.

    C A 2 Replies Last reply
    0
    • E E6AD

      HI All, I am trying to call a function from a dll. One of its parameters is a structure that I will need later to call another function from another dll but the problem is that I don't know its detailed structure to be able to marshall it in C#. I am not interested in accessing the struc:confused:ture's attributes,it's a temporary step for me before calling the other function. However,it must be accuartely done in order to pass a correct argument to the other function. Can I just marshal the unknow datatypes within the structure as it they were "void"? Any ideas or suggestions? It's really has been puzzling me for a time now and I can't reach a solution Thanks and Best Regards, E.A.

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      IF the dll is a Microsoft one, then pinvoke.net[^] might help. Either way, it would give you examples showing how this is done. Christian Graus - Microsoft MVP - C++

      E 1 Reply Last reply
      0
      • C Christian Graus

        IF the dll is a Microsoft one, then pinvoke.net[^] might help. Either way, it would give you examples showing how this is done. Christian Graus - Microsoft MVP - C++

        E Offline
        E Offline
        E6AD
        wrote on last edited by
        #3

        Thanks Christian Unfortunately,it's not a MS one.It's an Intel one. I have already checked the pinvoke documentation and marsalling in msdn but it didn't provide me with examples in my case. do you have any idea what can i do? Thanks and Best Regards, E.A.

        1 Reply Last reply
        0
        • E E6AD

          HI All, I am trying to call a function from a dll. One of its parameters is a structure that I will need later to call another function from another dll but the problem is that I don't know its detailed structure to be able to marshall it in C#. I am not interested in accessing the struc:confused:ture's attributes,it's a temporary step for me before calling the other function. However,it must be accuartely done in order to pass a correct argument to the other function. Can I just marshal the unknow datatypes within the structure as it they were "void"? Any ideas or suggestions? It's really has been puzzling me for a time now and I can't reach a solution Thanks and Best Regards, E.A.

          A Offline
          A Offline
          Anonymous
          wrote on last edited by
          #4

          If you know the total size of the structure and if the contents of the structure dont matter, then you can try allocating memory equal to the size of the structure and pass the pointer to the memory as a void parameter instead of marshalling it as a structure. -Atul, Sky Software http://www.ssware.com Shell MegaPack For ActiveX & .Net - Windows Explorer Like Shell UI Controls

          E 1 Reply Last reply
          0
          • A Anonymous

            If you know the total size of the structure and if the contents of the structure dont matter, then you can try allocating memory equal to the size of the structure and pass the pointer to the memory as a void parameter instead of marshalling it as a structure. -Atul, Sky Software http://www.ssware.com Shell MegaPack For ActiveX & .Net - Windows Explorer Like Shell UI Controls

            E Offline
            E Offline
            E6AD
            wrote on last edited by
            #5

            What if I have the following case : struct x (whose structure is unknown) x* a = function(string m); int b= function2(a,....); If I used your idea, will it work in that case? Thanks for your help,I really appreciate it... Best Regards, E.A.

            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