How would I pass a struct from application to a class library API function?

If the library's source code is not accessible - then you can't.

Only if the function takes a structure in as a parameter can you pass it in.

You would have to recreate the function. ( to overload the first )

If you DO have the source code, just modify the dll et voila.

I do have access to the source code.

Here is the empty API function:

in .dll:

      public void RegisterInterface(Enum iface, "struct goes here"  Func<int> connect, Func<int> disconnect)
       {

       }

in application:

cfg is the struct.

 private void IFaceConn_Load(object sender, EventArgs e)
        {
            Interface.RegisterInterface(iface, ref cfg, ConnectFn, DisconnectFn);
        }

Here is some documentation on Method overloading.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.