caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Fabrice Le Fessant <Fabrice.Le_fessant@inria.fr>
To: "Pang, Wai (CA-CIB)" <Wai.Pang@ca-cib.com>,
	"caml-list@inria.fr" <caml-list@inria.fr>
Subject: Re: [Caml-list] FindLib loading dllunix.dll on vs2012
Date: Wed, 30 Mar 2016 17:36:42 +0000	[thread overview]
Message-ID: <CAHvkLrPzsT1kuNR+mrYnxjch=O=OaHovMna6yKZqD9ALh41ieg@mail.gmail.com> (raw)
In-Reply-To: <8A030C723E87D24B90827AE8C57403011F2DEAD2@EMMXPA023.emea.cib>

[-- Attachment #1: Type: text/plain, Size: 5209 bytes --]

Have you tried to use ocpwin ?

--Fabrice

On Wed, Mar 30, 2016 at 6:25 PM Pang, Wai (CA-CIB) <Wai.Pang@ca-cib.com>
wrote:

> Has anyone tried compiling FindLib with the visual studio 2012 or later.
>
>
>
> This is ok with visual studio 2008 and an old version of ocaml 3.11.
>
> I have also tried the most recent release tar balls of ocaml and flex
> without any success.
>
>
>
> FindLib package has a prebuild configuration to test loading dlls as:
>
>
>
> *ocaml unix.cma*  - > fails with Reason: .\dllunix.dll: Invalid access to
> memory location.
>
>
>
> (This command line routine has a dependency of ocamlrun.exe, pervasive.cma
> and dllunix.dll
>
> which I have compiled all from src code using vs 2012. I have tried both
> static and dynamic linkage to no avail.)
>
>
>
> This error originates from  flexdll.c in the *FlexDLL* package. It tries
> to call LoadLibraryEx and is returning null.
>
>
>
> *Further Testing *
>
>
>
> // A test to load dllunix dynamically ….
>
> #include <flexdll.h>
>
> #include <stdio.h>
>
> #include <windows.h>
>
>
>
> int main(int argc, char *argv[]) {
>
>     void *handle;
>
>     printf("Try open: %s\n", argv[1]);
>
>     handle = flexdll_dlopen(argv[1], FLEXDLL_RTLD_GLOBAL);
>
>     printf("Handle: %p\n", handle);
>
>     if (handle == NULL) {
>
>             printf("Error code: %d\n", GetLastError());
>
>             printf("Error message: %s\n", flexdll_dlerror());
>
>     }
>
>     return 0;
>
> }
>
>
>
> *cl -nologo -MD -I"D:\external\OCaml\FlexDLL_034" -c Testdll.c*
>
> *flexlink -v -merge-manifest -exe -o testdll Testdll.obj*
>
>
>
> *Direct test of dllunix.dll*
>
>
>
> *$./testdll dllunix.dll*
>
>
>
> *Try open:dllunix.dll*
>
> *Error code: 998*
>
> *Error message: Invalid access to memory location.*
>
>
>
> Instead of using dllunix.dll I have tried to compile a simple program for
> testing
>
>
>
> *A simplified test*
>
>
>
> #include <stdio.h>
>
> int x = 10;
>
> void dump_x(void) {
>
> printf("myplugin finds the value : \nx=%i\n", x); fflush( stdout );
>
> }
>
>
>
> *cl -nologo -MD  -I.. -c myplug.c*
>
> *flexlink.exe -chain msvc -merge-manifest  -v -o myplug.dll  myplug.obj
> -link ws2_32.lib*
>
>
>
> *$./testdll  myplug.dll*
>
>
>
> *Try open: myplug.dll*
>
> *Error code: 998*
>
> *Error message: Invalid access to memory location.*
>
>
>
> Note that   the dump exe in flexdll fails in the same manner
>
>
>
> *In vs2008 build this is ok *
>
>
>
>
>
> *$./testdll  myplug.dll*
>
>
>
> Try open: myplug.dll
>
> Handle: 01F6DB78
>
>
>
> Even running the test/dump.exe from flexDLL is ok
>
>
>
> *$ ./dump myplug.dll *
>
>
>
> INIT
>
> Dynamic symbol at 00412000 (size = 12)
>
> [0]  00402227: __iob_func
>
> [1]  00401BA0: api
>
> [2]  00402E7C: fflush
>
> [3]  004017F0: flexdll_dlclose
>
> [4]  004018B0: flexdll_dlerror
>
> [5]  00401580: flexdll_dlopen
>
> [6]  00401860: flexdll_dlsym
>
> [7]  00401900: flexdll_dump_exports
>
> [8]  00401A60: flexdll_dump_relocations
>
> [9]  00401000: flexdll_relocate
>
> [10]  00401BC0: main
>
> [11]  00401D0E: printf
>
> OK
>
> ** Loading myplug.dll
>
> ** handle = 01FEDB78
>
> Dynamic symbol at 004C0000 (size = 4)
>
> [0]  004B1000: FlexDLLiniter@12
>
> [1]  004B1170: dump_x
>
> [2]  004B11A0: torun
>
> [3]  004BC014: x
>
> myplugin finds the value :
>
> x=10
>
>
>
>
>
>
>
>
>
> This email does not create a legal relationship between any member of the
> Crédit Agricole group and the recipient or constitute investment advice.
> The content of this email (including any attachments) is intended solely
> for the addressee and access by any other person is not authorised. It may
> contain information which is confidential, privileged or otherwise
> protected from disclosure. If you are not the intended recipient of this
> email, (i) you should send it back to us and delete it from your system,
> and (ii) you are prohibited from retaining, distributing, disclosing or
> using (in whole or part) any of its content. Email communication may be
> logged and archived, monitored and/or disclosed to third parties.
>
>
>
> Crédit Agricole Corporate and Investment Bank is authorised by the
> Autorité de Contrôle Prudentiel et de Résolution (ACPR) and supervised by
> the ACPR and the Autorité des Marchés Financiers (AMF) in France and
> subject to limited regulation by the Financial Conduct Authority and the
> Prudential Regulation Authority. Details about the extent of our regulation
> by the Financial Conduct Authority and the Prudential Regulation Authority
> are available from us on request. Crédit Agricole Corporate and
> Investment Bank is incorporated in France with limited liability and
> registered in England and Wales. Registration number: FC008194. Registered
> office: Broadwalk House, 5 Appold Street, London, EC2A 2DA
>
> Please refer to
> http://www.ca-cib.com/group-overview/dodd-frank-otc-derivatives.htm for
> any Dodd-Frank Disclosure for U.S. Persons pursuant to CFTC Regulation
> 23.431
>

[-- Attachment #2: Type: text/html, Size: 11319 bytes --]

  reply	other threads:[~2016-03-30 17:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-30 16:24 Pang, Wai (CA-CIB)
2016-03-30 17:36 ` Fabrice Le Fessant [this message]
2016-03-31  8:03   ` Pang, Wai (CA-CIB)
2016-04-01  8:43 ` David Allsopp
2016-04-01  9:30   ` Pang, Wai (CA-CIB)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAHvkLrPzsT1kuNR+mrYnxjch=O=OaHovMna6yKZqD9ALh41ieg@mail.gmail.com' \
    --to=fabrice.le_fessant@inria.fr \
    --cc=Wai.Pang@ca-cib.com \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).