Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 667471
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T23:55:56+00:00 2026-05-13T23:55:56+00:00

I’m in the process of writing a C# wrapper for Dallmeier Common API light

  • 0

I’m in the process of writing a C# wrapper for Dallmeier Common API light (Camera & Surviellance systems) and I’ve never written a wrapper before, but I have used the Canon EDSDK C# wrapper. So I’m using the Canon wrapper as a guide to writing the Dallmeier wrapper.

I’m currently having issues with wrapping a callback. In the API manual it has the following:

dlm_connect

int(unsigned long uLWindowHandle,   
    const char * strIP,  
    const char* strUser1,  
    const char* strPwd1,  
    const char* strUser2,  
    const char* strPwd2,   
    void (*callback)(void *pParameters, void *pResult, void *pInput),   
    void * pInput)  

Arguments
– ulWindowhandle – handle of the window that is passed to the ViewerSDK to display video and messages there
– strUser1/2 – names of the users to log in. If only single user login is used strUser2 is
– NULL
– strPwd1/2 – passwords of both users. If strUser2 is NULL strPwd2 is ignored.

Return
This function creates a SessionHandle that has to be passed

Callback
pParameters will be structured:
– unsigned long ulFunctionID
– unsigned long ulSocketHandle, //handle to socket of the established connection
– unsigned long ulWindowHandle,
– int SessionHandle, //session handle of the session created
– const char * strIP,
– const char* strUser1,
– const char* strPwd1,
– const char* strUser2,
– const char * strPWD2
pResult is a pointer to an integer, representing the result of the operation. Zero on success.
Negative values are error codes.

So from what I’ve read on the Net and Stack Overflow – C# uses delegates for the purpose of callbacks. So I create a my Callback function :

public delegate uint DallmeierCallback(DallPparameters pParameters, IntPtr pResult, IntPtr pInput);

I create the connection function

[DllImport("davidapidis.dll")]
public extern static int dlm_connect(int ulWindowHandle, string strIP, string strUser1, string strPwd1, string strUser2, string strPwd2, DallmeierCallback inDallmeierFunc

And (I think) the DallPParameters as a struct :

[StructLayout(LayoutKind.Sequential)]
public struct DallPParameters
{
  public int ulfunctionID;
  public int ulsocketHandle;
  public int ulWindowHandle;
  ...
}

All of this is in my wrapper class.
Am I heading in the right direction or is this completely wrong?
Then in my Dallmeier class I have the following:

    private DallmeierAPI dallmeierAPI;  
    private DallmeierSDK.DallmeierCallback dallCallbackHandler;  
    private GCHandle handle;  
    private IntPtr pResult;  
    private IntPtr pInput;  

    internal Dallmeier()
    {
        this.dallmeierAPI = DallmeierAPI.Instance;

        registerEvents();
    }

    private void registerEvents()
    {
        // Register Callback Events
        dallCallbackHandler = new DallmeierSDK.DallmeierCallback(pParameters, pResult, pInput); // Error: Method Name expected

        handle = GCHandle.Alloc(dallCallbackHandler);
    }

    private void unregisterEvents()
    {
        handle.Free();
    }

    private DallmeierSDK.DallPParameters pParameters(int ulfunctionID, int ulSocketHandl, int ulWindowHandle, int SessionHandle, string strIP, string strUser1, string strPwd1, string strUser2, string strPwd)
    {
        // what goes in here : Error not all code paths return a value
    }


}

So when I register the callback its saying a Method Name expected?
and pParameters is expecting a return value?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T23:55:57+00:00Added an answer on May 13, 2026 at 11:55 pm

    You’re mostly on the right track.

    However, C longs are (I believe) 32-bit, and map to C# ints.
    Also, after calling the function, you must keep a managed reference to the delegate instance that you passed to make sure that the delegate doesn’t get garbage collected.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.