caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] How to build a library with c++ stubs
@ 2015-02-27 22:40 Leonardo Laguna Ruiz
  2015-02-27 22:45 ` Ivan Gotovchits
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Leonardo Laguna Ruiz @ 2015-02-27 22:40 UTC (permalink / raw)
  To: OCaml List

Hi,

I’m working on a library which wraps functions and clases written in C++. I’m trying to setup a build system based in oasis but I haven’t found any example on how to do it.

So far I have been able of compiling my test programs using cmake and ocamlbuild. I use cmake to generate a static library out of my C++ file. Then I call ocamlbuild (from cmake) to generate a object file from my main file (main.native.o). Finally I link everything using cmake.

I have tried to link the my test program with ocambuild by passing all the necessary flags (use stdlib=libc++ and link CoreFoundation and IOKit in OS X) but I haven’t succeeded using ocamlbuild (or oasis).

Does anyone has an example on how to build a library that uses C++ code?

Thanks,

Leonardo


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Caml-list] How to build a library with c++ stubs
  2015-02-27 22:40 [Caml-list] How to build a library with c++ stubs Leonardo Laguna Ruiz
@ 2015-02-27 22:45 ` Ivan Gotovchits
  2015-02-27 22:48 ` Martin DeMello
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Ivan Gotovchits @ 2015-02-27 22:45 UTC (permalink / raw)
  To: Leonardo Laguna Ruiz; +Cc: OCaml List

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

Hi Leonardo,

In BAP project we're building C++ bindings with oasis+ocamlbuild.  Look at
`cxx_rule` in `myocamlbuild.ml.in` file,
definitions like `cxx` and `cxx_flags` in `setup.ml.in` and, of course,
`_oasis`

Feel free to ask any questions,

Regards,
Ivan

[1]: https://github.com/BinaryAnalysisPlatform/bap

On Fri, Feb 27, 2015 at 5:40 PM, Leonardo Laguna Ruiz <modlfo@gmail.com>
wrote:

> Hi,
>
> I’m working on a library which wraps functions and clases written in C++.
> I’m trying to setup a build system based in oasis but I haven’t found any
> example on how to do it.
>
> So far I have been able of compiling my test programs using cmake and
> ocamlbuild. I use cmake to generate a static library out of my C++ file.
> Then I call ocamlbuild (from cmake) to generate a object file from my main
> file (main.native.o). Finally I link everything using cmake.
>
> I have tried to link the my test program with ocambuild by passing all the
> necessary flags (use stdlib=libc++ and link CoreFoundation and IOKit in OS
> X) but I haven’t succeeded using ocamlbuild (or oasis).
>
> Does anyone has an example on how to build a library that uses C++ code?
>
> Thanks,
>
> Leonardo
>
>
> --
> Caml-list mailing list.  Subscription management and archives:
> https://sympa.inria.fr/sympa/arc/caml-list
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Caml-list] How to build a library with c++ stubs
  2015-02-27 22:40 [Caml-list] How to build a library with c++ stubs Leonardo Laguna Ruiz
  2015-02-27 22:45 ` Ivan Gotovchits
@ 2015-02-27 22:48 ` Martin DeMello
  2015-03-01 12:04 ` ygrek
  2015-03-01 17:31 ` Shayne Fletcher
  3 siblings, 0 replies; 7+ messages in thread
From: Martin DeMello @ 2015-02-27 22:48 UTC (permalink / raw)
  To: Leonardo Laguna Ruiz; +Cc: OCaml List

Not my project, but looks interesting: https://github.com/JoeDralliam/Ocsfml

martin


On Fri, Feb 27, 2015 at 2:40 PM, Leonardo Laguna Ruiz <modlfo@gmail.com> wrote:
> Hi,
>
> I’m working on a library which wraps functions and clases written in C++. I’m trying to setup a build system based in oasis but I haven’t found any example on how to do it.
>
> So far I have been able of compiling my test programs using cmake and ocamlbuild. I use cmake to generate a static library out of my C++ file. Then I call ocamlbuild (from cmake) to generate a object file from my main file (main.native.o). Finally I link everything using cmake.
>
> I have tried to link the my test program with ocambuild by passing all the necessary flags (use stdlib=libc++ and link CoreFoundation and IOKit in OS X) but I haven’t succeeded using ocamlbuild (or oasis).
>
> Does anyone has an example on how to build a library that uses C++ code?
>
> Thanks,
>
> Leonardo
>
>
> --
> Caml-list mailing list.  Subscription management and archives:
> https://sympa.inria.fr/sympa/arc/caml-list
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Caml-list] How to build a library with c++ stubs
  2015-02-27 22:40 [Caml-list] How to build a library with c++ stubs Leonardo Laguna Ruiz
  2015-02-27 22:45 ` Ivan Gotovchits
  2015-02-27 22:48 ` Martin DeMello
@ 2015-03-01 12:04 ` ygrek
  2015-03-01 13:36   ` Peter Zotov
  2015-03-01 17:31 ` Shayne Fletcher
  3 siblings, 1 reply; 7+ messages in thread
From: ygrek @ 2015-03-01 12:04 UTC (permalink / raw)
  Cc: OCaml List

On Fri, 27 Feb 2015 23:40:04 +0100
Leonardo Laguna Ruiz <modlfo@gmail.com> wrote:

> Does anyone has an example on how to build a library that uses C++ code?

Here is one - http://stackoverflow.com/questions/21728826/building-c-code-with-ocamlbuild
 
-- 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Caml-list] How to build a library with c++ stubs
  2015-03-01 12:04 ` ygrek
@ 2015-03-01 13:36   ` Peter Zotov
  2015-03-03  8:43     ` Leonardo Laguna Ruiz
  0 siblings, 1 reply; 7+ messages in thread
From: Peter Zotov @ 2015-03-01 13:36 UTC (permalink / raw)
  To: ygrek; +Cc: OCaml List, caml-list-request

On 2015-03-01 15:04, ygrek wrote:
> On Fri, 27 Feb 2015 23:40:04 +0100
> Leonardo Laguna Ruiz <modlfo@gmail.com> wrote:
> 
>> Does anyone has an example on how to build a library that uses C++ 
>> code?
> 
> Here is one -
> http://stackoverflow.com/questions/21728826/building-c-code-with-ocamlbuild

I submitted an issue to make it better: 
http://caml.inria.fr/mantis/view.php?id=6798

-- 
Peter Zotov

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Caml-list] How to build a library with c++ stubs
  2015-02-27 22:40 [Caml-list] How to build a library with c++ stubs Leonardo Laguna Ruiz
                   ` (2 preceding siblings ...)
  2015-03-01 12:04 ` ygrek
@ 2015-03-01 17:31 ` Shayne Fletcher
  3 siblings, 0 replies; 7+ messages in thread
From: Shayne Fletcher @ 2015-03-01 17:31 UTC (permalink / raw)
  To: Leonardo Laguna Ruiz; +Cc: OCaml List

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

On Fri, Feb 27, 2015 at 5:40 PM, Leonardo Laguna Ruiz <modlfo@gmail.com>
wrote:

> Does anyone has an example on how to build a library that uses C++ code?


​This blog post may be of use
http://shayne-fletcher.blogspot.com/2014/02/extending-ocaml-in-c-boostdate-time.html​.
Hope this helps.

-- 
Shayne Fletcher

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Caml-list] How to build a library with c++ stubs
  2015-03-01 13:36   ` Peter Zotov
@ 2015-03-03  8:43     ` Leonardo Laguna Ruiz
  0 siblings, 0 replies; 7+ messages in thread
From: Leonardo Laguna Ruiz @ 2015-03-03  8:43 UTC (permalink / raw)
  To: caml-list

Thank you everyone for your answers.

I was checking the examples that Ivan G. and Martin D. sent.  But it 
took me some time to find out how everything worked, specially because I 
haven't made any ocambuild plugin and is my first time using oasis.

I ended up using the renaming of files as Ygrek suggested in the link. 
If the issue that Peter Z. is fixed I guess that I just need to rename 
the files back and remove the flags.

@Shane F. I used the method you describe in the blog post when I had my 
cmake based build system.

Soon I'll be releasing my library once I test that works correctly in 
all the platform I want to support.

Leonardo


On 2015-03-01 14:36, Peter Zotov wrote:
> On 2015-03-01 15:04, ygrek wrote:
>> On Fri, 27 Feb 2015 23:40:04 +0100
>> Leonardo Laguna Ruiz <modlfo@gmail.com> wrote:
>>
>>> Does anyone has an example on how to build a library that uses C++ 
>>> code?
>>
>> Here is one -
>> http://stackoverflow.com/questions/21728826/building-c-code-with-ocamlbuild 
>>
>
> I submitted an issue to make it better: 
> http://caml.inria.fr/mantis/view.php?id=6798
>


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-03-03  8:43 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-27 22:40 [Caml-list] How to build a library with c++ stubs Leonardo Laguna Ruiz
2015-02-27 22:45 ` Ivan Gotovchits
2015-02-27 22:48 ` Martin DeMello
2015-03-01 12:04 ` ygrek
2015-03-01 13:36   ` Peter Zotov
2015-03-03  8:43     ` Leonardo Laguna Ruiz
2015-03-01 17:31 ` Shayne Fletcher

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).