Dario Teixeira | 21 Nov 16:55
Favicon

Re: Dynlink with C++ source

Hi,

Thanks for the reply. In the meantime I managed to track down
the problem. Remember that I was using ocamlmklib to automate
the generation of the libraries:

blahcaml.cma: blahtex_stubs.o blahcaml.cmo
ocamlmklib -verbose -o blahcaml -oc blahcaml -cclib -lstdc++ $+

These are the actions taken by ocamlmklib:

+ gcc -shared -o ./dllblahcaml.so blahtex_stubs.o -L/home/dario/.godi/lib -Wl,-rpath,/home/dario/.godi/lib
+ ar rc ./libblahcaml.a blahtex_stubs.o; ranlib ./libblahcaml.a
+ ocamlc -a -o blahcaml.cma blahcaml.cmo -dllib -lblahcaml -cclib -lblahcaml -ccopt -L/home/dario/.godi/lib -ccopt -Wl,-rpath,/home/dario/.godi/lib -cclib -lstdc++

The problem is that ocamlmklib does not pass the -cclib -lstdc++
parameters to the first invocation of gcc. When I do it manually
then everything works. I'm filing this as a bug.

On a side note: how is the path /home/dario/.godi/lib obtained?
Sure, I can run `ocamlc -where` and remove the last two directories,
but I'm guessing there's a cleaner way, right?

Cheers,
Dario

__._,_.___
Recent Activity
Visit Your Group
Yahoo! Finance

It's Now Personal

Guides, news,

advice & more.

Ads on Yahoo!

Learn more now.

Reach customers

searching for you.

Yahoo! Groups

Cat Zone

Connect w/ others

who love cats.

.

__,_._,___
Dario Teixeira | 21 Nov 17:20
Favicon

Re: Dynlink with C++ source

> The problem is that ocamlmklib does not pass the -cclib -lstdc++
> parameters to the first invocation of gcc. When I do it
> manually then everything works. I'm filing this as a bug.

Hi again,

One small note: obviously you only pass "-lstdc++" to gcc, not
"-cclib" also.

Cheers,
Dario

__._,_.___
Recent Activity
Visit Your Group
Yahoo! Finance

It's Now Personal

Guides, news,

advice & more.

Search Ads

Get new customers.

List your web site

in Yahoo! Search.

Yahoo! Groups

w/ John McEnroe

Join the All-Bran

Day 10 Club.

.

__,_._,___
Florent Monnier | 21 Nov 19:09
X-Face

Re: Dynlink with C++ source

> Hi again,
>
> One small note: obviously you only pass "-lstdc++" to gcc, not
> "-cclib" also.

Indeed, I see that same difference too:

ocamlmklib -verbose -o mymod -lstdc++ mymod_stubs.o 
+ gcc -shared -o ./dllmymod.so  mymod_stubs.o    -lstdc++
+ ar rc ./libmymod.a  mymod_stubs.o; ranlib ./libmymod.a

ocamlmklib -verbose -o mymod -cclib -lstdc++ mymod_stubs.o 
+ gcc -shared -o ./dllmymod.so  mymod_stubs.o    
+ ar rc ./libmymod.a  mymod_stubs.o; ranlib ./libmymod.a

I have just added a short paragraph on C++ in my small tutorial there:
http://www.linux-nantes.org/~fmonnier/OCaml/ocaml-wrapping-c.php#ref_cplusplus
if you have some time to review this part, I would appriciate

cheers
Florent

------------------------------------

Archives up to December 31, 2007 are also downloadable at http://www.connettivo.net/cntprojects/ocaml_beginners/
The archives of the very official ocaml list (the seniors' one) can be found at http://caml.inria.fr
Attachments are banned and you're asked to be polite, avoid flames etc.Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/ocaml_beginners/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/ocaml_beginners/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:ocaml_beginners-digest <at> yahoogroups.com 
    mailto:ocaml_beginners-fullfeatured <at> yahoogroups.com

<*> To unsubscribe from this group, send an email to:
    ocaml_beginners-unsubscribe <at> yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

Dario Teixeira | 21 Nov 20:03
Favicon

Re: Dynlink with C++ source

Hi,

> Indeed, I see that same difference too:

Yeap, ocamlmklib seems to invoke gcc fine as long as the
-cclib option is not used.

> I have just added a short paragraph on C++ in my small
> tutorial there:

I would just add a brief note on linking stdc++. That's
the most common source of errors for interfacing with C++.

Cheers,
Dario


__._,_.___

Gmane