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