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

  • SEARCH
  • Home
  • 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 6033659
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T05:30:55+00:00 2026-05-23T05:30:55+00:00

I have a c# dll library with one method g accepting the following function

  • 0

I have a c# dll library with one method g accepting the following function f in C# as an input

 void f(double[] x, ref double func, double[] grad, object obj)

In the function body, both func and grad values are updated. The input signature of g(f) in F# reads

f:float[]-> byref<float> -> float[]-> obj->unit

how can I write f in f# to use g(f) in f#?

EDIT when I follow ildjarn’s answer below like

let f(x:float[]) (func:byref<float>) (grad:float[]) (obj: obj) = 
    func <- ...
    grad.[0] <- ... 
    grad.[1] <- ...
    ...
    ()

I got error on g(f) with

This function value is being used to construct a delegate type whose signature includes a byref argument. You must use an explicit lambda expression taking 4 arguments.

what should I do to make it work? thanks.
UPDATE: it turns out I have to use g(fun (x:float[]) (func:byref<float>) (grad:float[]) (obj: obj) -> .... Cannot give the inside function a name like f.

  • 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-23T05:30:56+00:00Added an answer on May 23, 2026 at 5:30 am
    let function1 (x:double[], func:byref<double>, grad:double[], obj:obj) = ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a DLL library, but I am not familiar with it. How can
I have a .net library dll that acts like a functional library. There are
I have written a C# class library (DLL) and wondering the quickest way to
I have to build OEM versions of a COM library (DLL). Does anyone know
I have a managed dll that calls into a native library. This native library
I have an ASP.NET application that uses a custom .NET library (a .DLL file).
I have a managed class library (say mylib.dll) and a 3rd party managed app
I have a class library project that references the version 4.1 Microsoft.Practices.Common dll. I
I'm publishing an open-source library on CodePlex, and want the dll files to have
I have DLL and application that will call some function in this dll. For

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.