Version française
Home     About     Download     Resources     Contact us    
Browse thread
Accessing fields of exported records
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: magesh_kannan <magesh_kannan@y...>
Subject: Accessing fields of exported records
Hi All,

I have a module (Module1) which has a record type

type myrec =
{
field1: int;
field2: int;
}

This type is exported (using the MLI file). This module also has an
(exported) function that returns a value of this type.

In another module, I do this.

let val1 = Module1.fun_that_returns_myrec () in
printf "%d\n" val1.field1


This works only if I "open Module1". Otherwise, I get an unknown
label error message. Is there a way to use the record fields without
opening the module?

Thanks for your help,
Magesh